Hello Ab,
To represent a vertex in 3D space use BRepBuilderAPI_MakeVertex.
Example:
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(outsidePoint);
Handle(AIS_Shape) vertexShape = new AIS_Shape(vertex);
AISContext->Display(vertexShape);
To test whether a point lies within a solid use BRepClass3d_SolidClassifier.
Example:
// Checking whether a point lies within or outside a solid.
void main()
{
TopoDS_Shape box = BRepPrimAPI_MakeBox(gp_Pnt(0,0,0), 100,100,100);
gp_Pnt outsidePoint(200,0,0);
gp_Pnt insidePoint(30,30,30);
if (pointLiesWithinShape(box, outsidePoint) == TopAbs_OUT)
{
qDebug() << "Outside point confirmed.";
}
if (pointLiesWithinShape(box, insidePoint) == TopAbs_IN)
{
qDebug() << "Inside point confirmed.";
}
}
TopAbs_State pointLiesWithinShape(TopoDS_Shape shape, gp_Pnt point)
{
if (shape.IsNull() || shape.ShapeType() != TopAbs_SOLID) {
return TopAbs_UNKNOWN;
}
BRepClass3d_SolidClassifier solidClassifier(shape, point, Precision::Confusion());
return solidClassifier.State();
}
Kind Regards
Commenter-1