Region selection of solids and faces

What's the best way to implement screen selection (e.g. a rectangular region) of shapes? I have a path and a vector, defining the area selected and the view Z direction, and I want to determine if a given solid, face, edge, or vertex falls into this region.

Creating a solid from the path and vector and then doing BRepAlgoAPI_Common seems a bit heavyweight but has the advantage that it could be used with perspective transforms also.

Triangulate the shape and then check for polygonal prism / triangle intersections?


wayne606's picture

I think I got it:

Create a face with the polygon
Create an infinite prism with the face and vector (as a direction) using BRepPrimAPI_MakePrism
Check the distance from the prism to each shape of interest using BRepExtrema_DistShapeShape

For some reason the InnerSolution() method did not work for me but Value() < Precision::Confusion() is good enough.