# How to make rigid body approximation?

Hello everyone,
I’ve been looking for a way to make one rigid body mesh approximate another automatically.

To make it simpler, I made two similar ellipses.

If the red one approximates the black one perfectly, it’ll look like the picture below. The red mesh will deviate from the black one evenly, and share the same centroid with it.

Now my rough plan is to use the GHPython component, and do the loop of the below steps:

(1) Making section curves of the 2 ellipses.

(2) Using the Rhino command CrvDeviation. Finding the point that deviates most, then I can get the deviation distance and approximation vector. Like the picture below.

(3)Moving the red one with the vector and half of the distance number.

(4)Keeping doing those steps by looping, until it can’t approximate anymore.

Please give me some advice about it. Or is there a tool of Rhino/GH could do the approximation? Any information will help me a lot.

Mesh and curve are different, better show your mesh.

See attached and try to translate it to P (or learn C#). Or wait for someone who likes native components.

Curve_MoveSlaveToMaster_V1.gh (124.9 KB)

BTW: you may add some option as well (like using the crvs centroids etc).
BTW: you may replace Crvs with Meshes (if so use Mesh Vertices instead of division pts). Or (general case: mixed input) declare master, slave as GeometryBase Type and act accordingly for finding the m/sPts.

In any case use a Point3dList or a RTree for defining the Vectors.

here I am
this is what I believe being a “transcription” in GH native components of Peter’s code

Curve_MoveSlaveToMaster_V1_Re.gh (132.7 KB)

you’ll need Anemone for looping

Well … translate the general case as well (mixed input types [Crvs/Meshes]).

Curve_MoveSlaveToMaster_V1A.gh (130.1 KB)

1 Like

1 Like