How does RemoveShortSegments() work?

I’m trying to remove short segments in a curve using rhinocommon’s RemoveShortSegements method.

This works well for some situations, but not for all, see attached example.

Can anyone explain how the method works, and why it is able to remove some short segments, and misses others?

RemoveShortSegments().gh (37.6 KB) (35.0 KB)

try dialing the slider in this.
just had to look out for what is returned from RemoveShortSegment()

Thanks, but I don’t see what dialing the slider changes. If I set it to 6 for example, it neatly removes all segments shorter than 6mm, but I want to remove segments of 2mm.

that’s because segments are defined a little differently
if you turn the recursive parameter to false on the explode component, you’ll see that some segments are actually two “segments”

not sure why but this is visually two segments but it is recognized as one by the RemoveShortSegments()
kinda makes sense. it looks like a generative error and should really be like the one to its left…

Thanks again, but the part that you highlighted isn’t actually one exceeding the 2mm threshold. The part on the curve right below there is, and is not removed by RemoveShortSegments(). I wonder why!

same. that short segment isn’t really a segment
image image

In what way is it not? With recursive exploding set to true you still end up with that segment right?

Also, if you take the segment that you get with recursive exploding set to False, and remove short segments from thát segment, you still end up with the same short segment.

Is there a way to find out who wrote a specific method? I would like to ask the creator directly, since I’m really interested in how the algorithm works, and in what way it could be improved to also work in cases as shown above.