Brep.Split() returns split objects in which order?

rhino

#1

What determines the order of the objects returned by Brep.Split()? I have to programmatically find the ones on a particular side of the splitter and have been unsuccessful so far.


(Menno Deij - van Rijswijk) #2

This seems to depend on the tide of the sea, the phase of the moon and the distance of your computer to the nearest flock of sheep. In other words, quite random. I have even seen it give different order for the same splitter with slightly different input Brep. Frustrating, but you have to live with it :smile:

What I usually do is to determine the bounding box center and size (diagonal) of each part, and relate that to the location of the splitter. Then, based on these values make some heuristic that sorts the parts for me.

For example, if you splitter happens to be a plane, you can use the signed distance from the plane Plane.DistanceTo(Point3d) to decide if it is above or below the plane.


(Chuck Welsh) #3

Brep.Split() merges the faces of the splitter and the splittee, then traces through the faces of the result that came from the splittee, keeping together faces that are not separated by edges that came from both. The order of the results would then be determined mostly by the order in which the faces appear in the intermediate merged Brep. This is mostly determined by the order that the faces appear in the original inputs.