Has anyone attempted to use Galapagos to make a better “Rebuild Curve” tool ?

Rhino’s way of rebuilding curves is appalling because better results can be achieved with fewer points by hand-editing, but of course, no one wants to use their hands anymore, right ?

Rebuild isn’t meant to be accurate to the source curve. It makes a better structured curve by essentially equaling out the control points which usually results in smoother looking curves. For accuracy there is fitCurve. But these are all based on maths not necessarily how “good” it looks which is a human criteria. Seems you might need to make one that fits the goals you want to achieve. Can you make a list of your criteria? If so then it shouldn’t be hard to automate.

Hi Michael,

I need to add that I mainly use rebuild to merge multiple curves in one ; mostly polylines.

FitCrv doesn’t help at all in this case.

I don’t care too much about how the curve “looks”.

I’m looking for more objective criteria like respect of end tangents and minimizing the area between initial curve and the rebuilt curve.

Approximating a polyline with a low number of control points.3dm (1018.5 KB)

I agree with Olivier that rebuilding curves with Galapagos could be a means to create curves with fewer controlepoints and greater fidelity.

There is the command RebuildCrvNonUniform that already creates cleaner curves within tolerance. What’s great about it, is the fact that you can specify the max cpoints and required tolerance. The command then returns a result that falls within those limits if possible.

I imagine that type of “intelligence” could be extended in an even smarter rebuilding tool.

-Willem

I need to add that I mainly use rebuild to merge multiple curves in one

This changes everything…

Maybe something like this helps? Complete restoration of (cuts in) curves?

Is the idea to get rid of some kinks at the point which the curves join?

No. The idea is to rebuild so as to get a single curve with the requested number of control points, the said control points location being optimized so as to minimize the deviation from the initial curve, and also spread the deviation the most evenly possible.

I think I almost never use “RebuildCrv” on single curves ; I can’t see the point for that since, as you said, FitCrv would do a better job.

I think I almost never use “RebuildCrv” on single curves

For me I use it to make a nicer curve than I drew. I use fitCurve if I need to keep the shape.

Ah… Artists

My curves are the results of tension equilibriums, or NACA profiles, etc… but rarely an inspired artistic gesture.

Well, anyways, I’ll give Galapagos a try since there is nothing out there already.

I’ll come back with whatever I have came up with.

OK, here’s what I did :

Galapagos RebuildCrv smart.gh (29.9 KB)

The input curve is in fact composed of 6 joined curves.

The definition rebuilds this to a single degree 3 curve with 10 points and Galapagos fiddles with the coordinates of these points to minimize the sum of distances between 100 sample points on the resulting and initial curve.

I managed to get down to around 19 for the goal function value.

Can you do better ?

Two problems :

-The slider lower and upper bounds should be adjusted to the coordinate range of the starting curve (which can be done with Metahopper probably).

-This method is hard to adapt to a different number of control points because you need to create (and define as genes) more sliders if you want more control points. Not very convenient…

hi @osuire,

you can use this curve_deviation_csharp.gh (5.5 KB)

component to get the curve deviation and use it as fintess for galapagos or as @DavidRutten suggested to me - use the square of the max deviation value.

I’m working on similar thing. What I do is using NurbsFromControlPoints

create a bunch of points depending on the degree of the curve you wish to fit to. Make sure you adjust the degree correctly.

For the control points use construct point component with sliders that you can attach to galapagos as genomes.

Make sure your 1st and last point match the start and end of the curve you wish to fit.

Caveat: Galapagos tends to pick wrong solution to stagnate and starts to give random values to the wrong direction. This leads to absurd results or premature abortion of the process. Good idea is to make sure your control points do not make a knot from the curve. Use some relative values between the control points.