Optimize the plane to 3D curves using Galapagos


I have 02 3D curves that are the bottom reference of the road.
I want to define a flat slab below the road. The slab must to put right angle to keep the thickness of variable part as small as possible and the max distance as minimum as possible.

What I did:
I’m trying to find the plane that the total distances from the curve to the plane as small as possible. (the plane can not cut the curves).
I used Galapagos to optimize the total distance. (see the GH file).
Findplane.gh (25.9 KB)

The issue:
Each time I run, I find a new plane that is not fit with the old plane. (sometime it can not finish the test. )

I checked and the result is depend on:

  • The 03 points that use to define initiation plane. I took 02 lowest points of each curve and average point of 02 curves.
  • The start number of genes pool.

Does anyone have better idea to make this approach more sustainable ?
Or another idea to find the plane.

Thank you,

I found a reason that changed the result in Galapagos.
It’s better to use small number in the math. (10 instead of 1000000).


Galapagos isn’t necessary for this at all.

Your geometry is extremely far away from the origin which makes it painfully slow for Rhino to manipulate (gumball rotation) and can cause errors. GH is extremely unresponsive.

Your unit dimensions are mysterious. Your curves are ~55 thousand units long!? The end points of your curves are ~1400 units apart (millimeters?), and one end is ~1000 units wider than the other?

Your curves are going opposite directions. And they are polylines so lofting them together makes a polysurface instead of a single surface.

Here are two ways to do this:

Findplane_2019Nov19a.gh (17.6 KB)

Thank Joseph,

Yes. This is road design. So the length is normal. I think you misunderstood what I need.

  1. The surface is one flat plane.
  2. The plane is not allowed to cut the curves.
  3. The total length between from 02 curves to the plane is minimum.

Anw, the issue was fixed as I answered above.

Thank you,

I hope you didn’t misunderstand what I said. I stand by all of it.

Findplane.3dm (279.5 KB)
Here is the result from Galapagos that I was looking for- One plane - it will become top of prefab beam for the next step. The polysurface is not accepted.


Yo, adapted from this yesterday:

Using your curves (UNFLIPPED or FLIPPED):

Findplane_2019Nov19b.gh (28.2 KB)

Galapagos isn’t necessary for this at all.

Your plane is cut the curves.
So it’s not good in this case.

Thank again for your time,


Look, there was an error in version ‘b’ above, due to the difference in scale of the two models.
Fixed below. The Plane Fit ‘dx’ (deviation) is only 15.58 units (millimeters?). You can move the plane that far down if you must. The fact is though that your curves are not co-planar.

Findplane_2019Nov19c.gh (27.9 KB)

Galapagos isn’t necessary for this at all.

Here’s a brute force search of you plane - not sure if you can actually get any better than that :smiley:

Findplane_Edit.gh (45.3 KB)

1 Like

The surface need to be under of the road. So I moved it down -205mm.
I tried move up 15mm, but the total length is not optimize compare to the galapagos.

Anw, your method is also good.
Findplane_2019Nov19d.gh (26.4 KB)


Using all the curve control points instead of only the end points (see switch in blue group below) , the Plane Fit ‘dx’ (Deviation) jumps from 15.58 units (millimeters?) to 100.27 units!

Findplane_2019Nov19d.gh (27.8 KB)

I have no way to determine which is the “better” Plane Fit result? Regardless, note that I projected the control points to the plane and created co-planar interpolated curves (IntCrv) before lofting to make the planar surface.

P.S. Using curve division points (10 per curve) for Plane Fit instead of end points or control points, the deviation is 86.0 units.


1 Like

In retrospect, I realized that projecting control points and interpolating them wasn’t a good idea, so I looked at this again.

First, I had to deal with the extreme unresponsiveness of GH/Rhino, which made it too difficult to modify the model. I added a switch between “In Place” and “Move to XY”, which moves both curves to the ‘World XY’ origin. This fixes the poor responsiveness issue!


Later, I discovered accidentally that this revised model works well “In Place” as long as certain kinds of geometry are avoided. For example, there is a disabled “SLAB” group with a big warning to “Use ‘Move to XY’ feature before enabling”.

Otherwise, I added some features and options to visualize the true shape of your curves relative to a ‘World XY’ plane with its origin at the lowest end point (white ‘X’).

‘Plane Fit’ origin is adjusted automatically to the lowest position to avoid being above any of the points. The blueish surface below uses the original curves and is definitely not planar! The light green surface is planar, derived from projecting your curves to the adjusted ‘Plane Fit’. But is that really what you want? It appears to deviate from the original surface by up to ~220 units (millimeters? 8 inches?).

Findplane_2019Nov23a.gh (47.6 KB)