[Papercut?] MeshLine intersection point order

There’s a small papercut that took me quite long to figure out:
for since for 99% of the cases Rhino.Geometry.Intersect.Intersection returns points in the same order as the line you cut with (from start to end). And in some cases they don’t.

I’m not sure f this was the intended behavior, and the solution for it this problem is trivial, but figuring out the behavior was not. A small note in the documentation that the point order can be random could be an improvement.

Attached is a grasshopper file to reproduce this behavior
MeshLineBug.gh (1.9 MB)

Hi @arendvw,

Please try this in the Rhino WIP, as it contains a new mesh intersector.

We don’t be making modification to the mesh intersector in Rhino 6. So if order is important, you might want to sort the points yourself along the intersecting line.

– Dale

Thanks for the tip, I will check it out!

@dale I don’t think there’s any difference in WIP regarding this part of intersections. The new intersector is about meshes, and doesn’t deal with line+meshes.

That being said, the documentation does not state anything about the order, and the goal of the RhinoCommon call is to be fast, not to put things in order, and the two are diverging objectives.

This is fair. However, it was not very intuitive for me, and it might not be intuitive for other developers to figure this out as well. In my case, 98% of the cases came out sorted, which wrongly led me to assume the function would always do this.

My main suggestion is to rather than to document this behavior implicitly (no documentation = you’re not allowed to assume anything, you figure it out), to explicit (we make no guarantees about how the output is sorted).

1 Like

I reported RH-58848 and will add a sorted version of this. I will also improve the documentation for V7.

Please let me know if you need a short sample of how to make this work in V6.

1 Like