- Standard_Real U, V;
- gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V);
- if (aP.SquareDistance(aPonF) < squareTolerance) {
- if (isNormalized) {
- // Normalize parameters to be in [0, 1]
- U = (U - U1) / dU;
- V = (V - V1) / dV;
+ try { // as GEOMUtils::ProjectPointOnFace can throw exceptions
+ Standard_Real U, V;
+ gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V, aTol);
+ if (aP.SquareDistance(aPonF) < squareTolerance) {
+ if (isNormalized) {
+ // Normalize parameters to be in [0, 1]
+ U = (U - U1) / dU;
+ V = (V - V1) / dV;
+ }
+ aRet->SetValue(iP * 2 , U);
+ aRet->SetValue(iP * 2 + 1, V);
+ }
+ else {
+ SetErrorCode("Point too far from face");
+ return aRet;