}
// Face tolerance
- Standard_Real squareTolerance = BRep_Tool::Tolerance(F);
- squareTolerance = squareTolerance * squareTolerance;
+ Standard_Real aTol = BRep_Tool::Tolerance(F);
+ Standard_Real squareTolerance = aTol * aTol;
// Compute parameters
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
gp_Pnt aP (theXYZlist->Value(iCLower + iP * 3),
theXYZlist->Value(iCLower + iP * 3 + 1),
theXYZlist->Value(iCLower + iP * 3 + 2));
- 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;
}
- aRet->SetValue(iP * 2 , U);
- aRet->SetValue(iP * 2 + 1, V);
}
- else {
- SetErrorCode("Point too far from face");
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return aRet;
}
}