Inaccuracy in BRep_Tool::CurveOnSurface


Does anyone know how to improve the accuracy of the 2d curves from BRep_Tool::CurveOnSurface?

I have an example surface from a step file. I get the 3d trim curves from 
BRep_Tool::Curve(edge, first, last) and the matching 2d trim from BRep_Tool::CurveOnSurface(edge, face, umin, umax).
When I test for the accuracy of the 2d trim curve, I step along the 2d trim curve, get
the uv coords, feed these values to ShapeAnalysis::Surface.Value(u,v) to get the surface
point. In theory these surface points should lie on the 3d trim curve but for this particular
case they don't.

Any help in improving the accuracy would be great.

Many thanks.

Benjamin Bihler's picture


for numerical reasons this is quite normal. The distance should be very small, but it usually is not zero and sometimes it may be so high, that some criteria even say that the point is not where you expect it to be.

If you need to process your points on the 3d curve, you might want to project them (even though in theory this is unnecessary) to get consistent behaviour (check ShapeAnalysis_Curve for projection).


Chi Fung's picture

Hi Benjamin,

Thank you for your reply. I wasn't expecting the distance to be zero but in my case the discrepancies

were visible if you draw them.


Benjamin Bihler's picture

Depending on the zoom factor I also had that quite often.