There is no such thing as "a formula" for this. In the world of drafting, this used to be called "developments and intersections." There now exists software for this, which is unusable unless one knows the principles in the first place.
__________________
In vino veritas; in cervisia carmen; in aqua E. coli.