This is pretty much my first post here, and I wasn't sure as to where this might belong as it's related to many things at once, but I don't have enough knowledge to be able to pin this down to any particular area.

Pretty much, I was looking for the closest distance between two cylinders with radius r1, r2, length l1, l2.

Basically, in 3D space, each cylinder can be represented by two dots at the center of the two bottom surfaces of the cylinders, plus its radius.

I have to be able to find a way to determine the distance, and judge if they collide or overlap, with a function or functions.

The issue I seem to be having is the fact that I can't seem to be able to make a 3-D set of equations using this data.

I was planning on using the 2*(pi*r^2)+ (2*pi*r)*h equation for surface area, but I have no idea as to how I can apply this equation in 3-D space and try to accommodate a 3-D distance equation, or the square root of (x2-x1)+(y2-y1)+(z2-z1), which is the only thing I have been able to find online.

If you have any recommendations or different equations/methods I can use that maybe easier, please let me know...

Thanks in advance