View Full Version : Calculate intersection of two cylinders Solution!

06-07-2002, 03:49 PM
I thought I post this as I had to figure it out for myself. I needed this to draw a line around the cylinders so that the intersection would show in a hidden line mode.

Here is the formula for calculating the intersection points of 2 cylinders where the centerline of the cylinders intersect.

Brad = Branch Radius
Mrad = Main Radius
TX = the X coord of the intersection
TY = the Y coord of the intersection
TZ = the Z coord of the intersection

deginrad = the Degrees in Radians of the position we are at in the branch's circluar path.

ANG = the Angle of inclination of the Branch cylinder.

First here is the basic easy formula for the intersection of a 90 degree set of cylinders.

TX = Cos(deginrad) * Brad
TY = Sin(deginrad) * Brad
TZ = Sqr(Abs(Mrad ^ 2 - TY ^ 2))

The formula for TX was the one no one could help with.

This lets you set the angle of the branch and get the points you need.

TY = Sin(deginrad) * Brad
TZ = Sqr(Abs(Mrad ^ 2 - TY ^ 2))
TX = (Cos(deginrad) * Brad / Cos(Ang)) + (Tan(Ang) * TZ)

The simple things get away from you sometimes..