Intersection between a circle and a Face

Could someone help me on the following issue? It's been bothering me for monthes. It is used to sort in sequence a set of faces along their common edge.

The problem is described as:

Input: Geom_Circle aCircle, TopoDS_Face aFace
Output: the intersection point between aFace and aCircle.

GeomAPI_IntCS might be used to compute the intersection point between a curve and a surface. But how to decide which of the intersection point belong to aFace. I tried BRepClass_FaceClassifier, but it doesn't work well, I am afraid.


Stephane Routelous's picture

Hi Mark,

if you work with the surface of your face, it's normal you're losing the boundary information.
try to use BRepExtram_DistShapeShape (high level api : convert your circle in edge ) or BRepExtrema_ExtCS (lower level API) or Extrema_ExtCS (lowest level API with GeomAdaptor and BRepAdaptor)

BTW, you can see that in the code of BRepExtrema_ExtCS, BRepClass_FaceClassifier is used.



Ming_39674's picture

Thx Stephane.

Just make sure first that you mean BRepExtrema_ExtCS is used to decide the intersection point between an edge and a face instead of their underlying curve and surface ?

Bearloga's picture

If your task is to sort faces around a common edge, it is better to solve it without intersections, but directly evaluate tangent vectors starting at a point on the edge and directed inside the faces.
To determine such vector, take the normal to the surface at this point and the tangent to the edge, cross product will show the line. You should only determine on which side of the line is the material of your face. For that take a point near to the line origin (i.e. near the edge), project it on the surface of the face and classify the projection IN or OUT.
After that you will have a set of vectors lying in the same plane to sort.

Ming_39674's picture

Hi Bearloga,

A good idea.
What I am slightly worried is 1. some faces may share the same tangent direction, e.g. a face and the face trangent to it along an edge. That's why I finally decided to use the intersection point instead of the tangent direction. But, if such case doesn't appear, your method is better. 2. classifying a point IN or OUT a face sometimes is not stablely implemented in OpenCASCADE. Any idea about it?