I wish there was either a second version, of the “Curve To Polyline” component that would have a number of segments as input.
It could also be a new input for the current component ; some sort of override for the “Tolerance” inputs.
You could see it as a “Divide curve” + “Polyline from points” combo, except it would place the points in such a way that it minimizes the deviation.
I did it by hand for my two main (orange) curves , but now I need to do it for all the blue curves, and it looks like I’m going to have to make an optimization loop with Anemone or something.
Of course, whatever the number of curves, I want the number of segments in the resulting polylines to be all equal.
This is useful when moving downstrean in the definition when you want to connect the vertices between the polylines that you created from the initial cures…
Normalize (and fit seams) your input curves, do a tween curve, use Curve to Polyline component, get point parameters, evaluate parameters in input curves.
I think Curve To Polyline works sequentially, finding points along the curve depending on the curvature and length, from start to end. So putting a result restriction, like setting the number of points, means redefining the algorithm completely.
Well, this will give me the same number of segments for two curves, but I still can’t control how many since “Curve to polyline” doesn’t allow this (thus my wish ! )
Moireover, it deals with a pair of curves like my two orange curves here, but that was done by hands in 10 seconds.
The real issue is the blue curves.
They ALL need to have the same number of divisions, but I want more divisions where the curvature is strong.
Your solution will work with each pair of curves, but will result in varying numbers of segments for each pairs.
Yes, but this restriction is useful, and a software should be useful
Normalize (and fit seams) your input curves, do a tween curve, use Curve to Polyline component, get point parameters,interpolate them with Interpolate Data and a Range with your desired amount of points, evaluate parameters in input curves.
Indeed, that would probably require an iterative/relaxation/optimisation method to find the best position of N vertices along the curves, minimising the error of approximation.
I learned a few tricks from your definition. The first part is close to doing what I want.
A proper iterative loop would probably get a better result, but this is good enough for my current shape which has smooth curvature variations
In the second part, however, by averaging the Z coordinates, you manage to get some global result but it works OK here only because the max curvatures are mostly around the center of the input curves.
Step 2 of my definition is optional, I assumed that you wanted to force them to be parallel to the ground and that can only work when the curvature of all the curves is similarly distributed. If you do it with high variance curves it becomes an optimization problem.
Another approach, in Pufferfish I have a Compatibilize Polylines component which forces them to have the same control point count. The lines wont be as nice and straight as @Dani_Abalde as this method looks at each curves curvature independently and tries to force compatibility while maintaining the individual polylines control points. Also doesn’t work by count. Thought it may still be worth mentioning.