CurveLoop.Simplify Generating New Curve Loop

In this post, Dimitar showed how to use CurveLoop.Simplify from Spring Nodes. I’ve been attempting to use it but wasn’t getting the results I expected. I did an experiment or two and found what I think might be a problem with the code.

If I take the same radiused corner rectangle with 50 segments but remove a line segment at random I get results that include the removed segment. Correct me if I’m wrong, but the point of the node is to simplify the existing curve loop, not generate a different curve loop.

Sadly, I don’t understand the code well enough to figure out what might be going on so I post this in hopes that someone smarter can offer insight.

Hi Greg. The problem here is that your curve is not a loop, i.e. it’s not closed. This was one of the assumptions used in the code. It should be possible to make a version for open loops, I’ll look into it when i get a chance.

I guess that’s why they call it a curve LOOP!

The solution I came up with was to create a new line connecting the start/end of the non-loop, run it through the CurveLoop.Simplify node and remove the line segment after. It works in my situation because the missing line segment is never collinear with other segments. I bet you could make this idea work even with a collinear segment with a bit more thinking.