Face and Circle Intersection

hi,
I made experiment, simple code in c++
The face and the circle as in the drawing actually intersect at one point,
I need to determine the coordinates of the intersection point.

The intersectionCalculator.NbPoints method shows two points, one is incorrect outside the face outline, outside the face area.

Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
gp_Pnt intersectionPoint;
GeomAPI_IntCS intersectionCalculator(circleGeom, surface);

int common = intersectionCalculator.NbPoints(); // this=2
if (intersectionCalculator.IsDone()
intersectionCalculator.NbPoints() > 0)
{
intersectionPoint = intersectionCalculator.Point(2);
BRepBuilderAPI_MakeVertex modelV11(intersectionPoint);

What I did wrong?

Thank you PD

gkv311 n's picture

GeomAPI_IntCS performs intersection between unbound surface and curve - it doesn't know about TopoDS_Face boundary Wire to filter out found solutions.

You may use tools taking BRep on input, like BRepIntCurveSurface_Inter, which should take into account boundaries, or handle boundaries on your own.

Piotr Dusiński's picture

Thank you
PD

Piotr Dusiński's picture

hi,
If I get 2 points, and I want to check which is a real intersection with face, can I use class BRepClass_FaceClassifier?

Can I be sure of this solution?

BRepClass_FaceClassifier classifier(face, intersectionPoint, 1E-3);

// Klasa wyniku
TopAbs_State classifierResult = classifier.State();

if (classifierResult == TopAbs_IN) {
tak = true;
}
else if (classifierResult == TopAbs_ON) {
tak = true;
}
else {
tak = false;
}