Projection Performance Problem


I'm having problems with Performance of point projection on a face.

I'm getting the surface from the face, and using GeomAPI_ProjectPointOnSurf to project the point; getting the LowerDistanceParameters and getting the 2d Point from the surface (surface->Value(U,V)); finally I'm using BRepClass_FaceClassifier to verify if the point is in/on or out the face.

Someone does know a better way to do this sequence?

Thanks in Advance.

Bearloga's picture

Hi Thiago,
One way to increase performance is to perform less real projections. If you project a point on the shape having many faces it is better initially to select the few nearest faces that are the best candidates for doing projection on them. For that you can iterate on all faces and compute location of the point relatively the bounding box, or you can use some algorithm that is based on binary search such as NCollection_UBTree.

tmacedo29's picture

Hi Berloga,

Thanks for your answer.
Actually I'm projecting 25500 points on just one face. I think it could be a performance problem with GeomAPI_ProjectPointOnCurve + BRepClass_FaceClassifier. I've tried to use all projection function and other ways to classifier the point, but I have no success.

Could you help me again?

Bearloga's picture

Try using the method ShapeAnalysis_Surface::NextValueOfUV. It allows to quickly find the solution of projection if you have a solution for a near point.

tmacedo29's picture

The points are independent one of them. It means there's 25500 calls to my projection function.
I think it won't help, will it?

And to classify? Is there another way to do it, instead of using BRepClass_FaceClassifier?