Some geometric stuff

Hello,

is it rigth if I say: "If a face has more than one wire, the face has holes."? How can I get to know which wire defines a hole (is inside)?

Does OpenCASCADE provide a function to create a DCEL for a face?

Greets
Patrick

Rob Bachrach's picture

I don't believe OCC has a DCEL representation available.
As far as finding which wire is a hole, I have three things you might want to try:
1 - When creating a face, you must specify the outer boundary wire first. Additional wires are assumed to be holes. Therefore, if you iterate through the subshapes of the face, you may get the wires in the same order (the first is the outer boundary).
2 - Although I have never used it, you may be able to use TopClass_FaceExplorer. It appears to give you one or more segments that intersect the face boundary. You can then use those segments on the wires to see which are inside or outside the face. I have a feeling that OCC uses this internally.
3 - As a last resort, you can take the first wire and create a face just from it (using the same surface as the original face). Then, pick a vertex on the next wire and use TopClass_FaceClassifier to see if the point is inside or outside the other wire. If outside, make a face with the new wire and continue until you know you have the outermost face. All others are holes.

Good luck,
Rob

CloneX's picture

You can use BRepTools::OuterWire to get the outer wire of the face. Then use TopExp::MapShapes to get the complete set of wires for the face and remove the outer wire from the set. What remains is the hole wires.

Hope that helps,

Chris