Intersection between a curve and a face (or a surface)

I need an algorithm which finds intersection points and common segments between a curve and a face.
I have done some navigation about this topic, in the forum and in the documentation, but none of the classes I have found seem satisfying:

--- IntCurvesFace_Intersector and IntCurvesFace_ShapeIntersector

1) They do not give common segments
2) :
“I strongly recommend you to use it with an infinite segment (actually a line)”.

--- GeomAPI_IntCS and IntCurveSurface_HInter

They are about a surface, not a face.
I could later discard the points which are out of the surface, with BRepClass_FaceClassifier, but ( ) "it seems that BRepClass_FaceClassifier doesn't work well actually".
I should also remove the (parts of) the common segments which are out of the face

---- IntTools_EdgeFace

Incredibly, for each point the curve parameter is output (by the IntTools_CommonPrt class), but not the face ones!
Its only user is the boolean operation algorithm, I wonder how it manages this issue.
Should I call a projection algorithm to find the parameters, which for sure IntTools_EdgeFace has already computed?

Thanks everybody.

Mauro Mariotti's picture

Forum supervisor,

there is a wrong comment in IntTools_CommonPrt class:

"Standard_Real VertexParameter2 () const
Returns parameter of second vertex"

There is no second vertex. The right comment should be
"Returns parameter of vertex on second edge"

This is confermed by its use in BOPTools_PaveFiller.cxx.

The same thing for method SetVertexParameter2.


Forum supervisor's picture

Dear Mauro,
Thanks for the remark.
I suggest you to register the issue in Mantis BugTracker which is available now via the Collaborative portal -

Timo Roth's picture

Isn't it possible to calculate the intersection of a face and an edge using BRepAlgoAPI_Section?
When I tried it, it didn't work.
Is it a bug or a limitation of the algorithm?
Is the algorithm made only for face-face (or higher, i.e. solid) intersections?

Here is a test case for Draw:

restore z-Bend.brep z
vdisplay z
explode z
bop z_1 z_2
bopsection r
whatis r
explode r

=> r is an empty compound

When I use the intersect command, the result is a point:

mkcurve c z_1
mksurface s z_2
intersect r2 c s
whatis r2

By the way, isn't there a command to convert a point into a vertex in order to display it in the AIS Viewer?


Timo Roth's picture