Polylines optimization

Hi.
Sometimes we’ve got really ugly contours/lines (like on the screen attached) for terrains or infrastructure elements which we have to process and use further (i.e. to build the meshes).

So the question is how to reduce/optimize/eliminate such ugly line cases like on the example shapes?

I know about ReducePolyline nodes, I even googled for algorithms like Ramer–Douglas–Peucker and similar, but I guess the main problem is how to justify the optimization of each segment? Increasing the tolerance may lead to eliminating the good segments, decreasing it – won’t bring needed effect on shape.

Has anyone faced with something similar?

Hi @Iyur ,

I don’t have a direct solution but one idea comes to mind.

If you run the Explode Curve component and use Cull Duplicate points on the vertices with a tolerance value of whatever is appropriate, you should be left with the “clean” vertices of the bits of curve that aren’t so jagged and the areas of the curve that are very tight/jagged/messy should end up with 1 vertex where previously there was 3 to 4 for instance.

You can then use the Polyline component to create a new polyline based off the remaining vertices which should result in the non jagged curves being preserved well without being simplified and the jagged bits being cleaned up quite a bit.

Does that make sense?

If you share the file I can probably mock up the idea.

Thanks!

1 Like