Sphere to Sphere Tangent Point Determination

Hi! I’m new to Rhinoceros and I’m looking to solve my dilemma. What I have are coordinates of sphere centers imported from CSV. These spheres are arranged randomly though discrete element modeling. I need to connect the spheres with cylinders at the tangent points but first, I need to know how to determine their location. Is it possible using python?

Query.7z (1.4 KB)

Are the spheres all the same diameter?

If two spheres are the same diameter, then the line segment between the sphere centers will be the center line of a cylinder of the same diameter of the spheres, and the cylinder will be tangent to both spheres.

Simple example using the Sphere, Line, and Cylinder commands (not Python): Sphere Cylinder 01.3dm (1002.3 KB)

1 Like

Hi David!

Thank you so much for your help! I will translate it to python code and will get back to you later.

If the spheres are not the same size then you have to make a small adjustment to make it tangent to both spheres. You don’t need this but it might be helpful to someone else who arrives on this page looking to solve that problem.

1 Like

Hi!

This code might be primitive to experts here. :smile: But just in case someone needs it or someone would like to correct my code, please feel free to do so and I would appreciate it!
Code1.py (1.5 KB)