Classify point with respect to a solid

Quaoar

Administrator
Staff member
To check if a point is inside or outside a solid body, one may use BRepClass3d_SolidClassifier. Here is a code snippet classifying the sample point gp_Pnt(10, 20, 30) with respect to the solid solid:

C++:
BRepClass3d_SolidClassifier class3d(solid);
class3d.Perform( gp_Pnt(10, 20, 30), Precision::Confusion() );
//
if ( class3d.State() == TopAbs_IN )
  std::cout << "Point is INSIDE" << std::endl;
else if ( class3d.State() == TopAbs_OUT )
  std::cout << "Point is OUTSIDE" << std::endl;
 
Top