For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

GeomAPI_ProjectPointOnSurf slow in 6.5.4? Use Extrema_ExtAlgo_Tree instead of Extrema_ExtAlgo_Grad?

Thorsten's picture


I switched from OCE-0.9.1 (OCCT 6.5.2) to OCE-0.11 (OCCT 6.5.4). Now the projections via GeomAPI_ProjectPointOnSurf seems to be very slow:

gp_Pnt pnt = ...
const TopoDS_Face & aktface = ...
const Handle_Geom_Surface & geomsurf = BRep_Tool::Surface(aktface);
Proj_punkt.Init(pnt, geomsurf);

If I use the alternative alg "Extrema_ExtAlgo_Tree" (new in 6.5.4, see release notes) I get the "old good" performance back:

const TopoDS_Face & aktface = ...
const Handle_Geom_Surface & geomsurf = BRep_Tool::Surface(aktface);
Proj_punkt.Init(newPnt, geomsurf, Extrema_ExtAlgo_Tree);

Why there are 2 algorithms (Extrema_ExtAlgo_Grad, Extrema_ExtAlgo_Tree)? The default algorithms seems to be "Extrema_ExtAlgo_Grad" although it seems to be slower than "Extrema_ExtAlgo_Tree". And last but not least: why is the same call "Proj_punkt.Init(pnt, geomsurf)" in 6.5.2 slower than in 6.5.4?

Are there any drawbacks in using "Extrema_ExtAlgo_Tree" instead of "Extrema_ExtAlgo_Grad"?


Albert's picture

Hi Thorsten,

I also wonder the same question.

Additionally, I need to iterate through several faces to find the closest projection of a point in a TopoDS_Edge or TopoDS_Wire. I'm importing from IGES and STEP.

Is there a way to quickly find the closest projection among several Faces (TopoDS_Face)?


Mauro Mariotti's picture

I cannot find any reference to Extrema_ExtAlgo_Tree
Could you give me a hint?

if your faces are all the faces of a solid or a shell, you could try with BRepExtrema_DistShapeShape (after making a vertex from the point).


Thorsten's picture

Search for "22826" in release notes

"The ability to use UBTree algorithm to find projection in Extrema_GenExtPS has been
added in GeomAPI_ProjectPointOnSurf."

and "22883"

Albert's picture

Thanks a lot for your quick reply.
I'm trying to code that.

Do you know if there is any way to retreive the TopoDS_Face that contains a TopoDS_Edge or TopoDS_Wire?
In other words, the face that was used to generate the edge or wire...

Thanks again,


Mauro Mariotti's picture

Unfortunately in OpenCascade, in contrast to other kernels, subshapes do not "know" their "parent" shapes.

You can get the faces which contain an edge only if you know an "ancestor" for them.
E.g., if the face is inside a solid, you pass it to TopExp::MapShapesAndAncestors this way:

TopoDS_Edge anEdge;
TopoDS_Solid aSolid;
Standard_Integer i = edgeMap.FindIndex(anEdge);
if (i) {
TopTools_ListIteratorOfListOfShape it;
for (; it.More(); it.Next()) {
const TopoDS_Face &aFace = TopoDS::Face(it.Value());


Albert's picture

Hi Mauro,

Thank you very much for all your advice. I tried to compute distances between Shape and Shape but it was still very slow. So finally I decided to compute distances between point and triangle (from the triangulated surfaces) and it is way faster.

Thank you anyways :)