mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
[bos #35094] [EDF] (2023-T1) X,Y,Z to U,V. Consider face tolerance.
This commit is contained in:
parent
9473f01eac
commit
e8fc8b6907
@ -3032,8 +3032,8 @@ Handle(TColStd_HArray1OfReal) GEOMImpl_IMeasureOperations::XYZtoUV
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Face tolerance
|
// Face tolerance
|
||||||
Standard_Real squareTolerance = BRep_Tool::Tolerance(F);
|
Standard_Real aTol = BRep_Tool::Tolerance(F);
|
||||||
squareTolerance = squareTolerance * squareTolerance;
|
Standard_Real squareTolerance = aTol * aTol;
|
||||||
|
|
||||||
// Compute parameters
|
// Compute parameters
|
||||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
|
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
|
||||||
@ -3049,8 +3049,9 @@ Handle(TColStd_HArray1OfReal) GEOMImpl_IMeasureOperations::XYZtoUV
|
|||||||
gp_Pnt aP (theXYZlist->Value(iCLower + iP * 3),
|
gp_Pnt aP (theXYZlist->Value(iCLower + iP * 3),
|
||||||
theXYZlist->Value(iCLower + iP * 3 + 1),
|
theXYZlist->Value(iCLower + iP * 3 + 1),
|
||||||
theXYZlist->Value(iCLower + iP * 3 + 2));
|
theXYZlist->Value(iCLower + iP * 3 + 2));
|
||||||
|
try { // as GEOMUtils::ProjectPointOnFace can throw exceptions
|
||||||
Standard_Real U, V;
|
Standard_Real U, V;
|
||||||
gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V);
|
gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V, aTol);
|
||||||
if (aP.SquareDistance(aPonF) < squareTolerance) {
|
if (aP.SquareDistance(aPonF) < squareTolerance) {
|
||||||
if (isNormalized) {
|
if (isNormalized) {
|
||||||
// Normalize parameters to be in [0, 1]
|
// Normalize parameters to be in [0, 1]
|
||||||
@ -3065,6 +3066,11 @@ Handle(TColStd_HArray1OfReal) GEOMImpl_IMeasureOperations::XYZtoUV
|
|||||||
return aRet;
|
return aRet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Standard_Failure& aFail) {
|
||||||
|
SetErrorCode(aFail.GetMessageString());
|
||||||
|
return aRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetErrorCode(OK);
|
SetErrorCode(OK);
|
||||||
return aRet;
|
return aRet;
|
||||||
|
@ -1032,7 +1032,8 @@ Standard_Real GEOMUtils::GetMinDistance
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
|
gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
|
||||||
const TopoDS_Shape& theFace,
|
const TopoDS_Shape& theFace,
|
||||||
double& theU, double& theV)
|
double& theU, double& theV,
|
||||||
|
const double theTol)
|
||||||
{
|
{
|
||||||
if (theFace.IsNull() || theFace.ShapeType() != TopAbs_FACE)
|
if (theFace.IsNull() || theFace.ShapeType() != TopAbs_FACE)
|
||||||
Standard_TypeMismatch::Raise
|
Standard_TypeMismatch::Raise
|
||||||
@ -1044,7 +1045,7 @@ gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
|
|||||||
BRepTools::UVBounds(aFace, U1, U2, V1, V2);
|
BRepTools::UVBounds(aFace, U1, U2, V1, V2);
|
||||||
|
|
||||||
// projector
|
// projector
|
||||||
Standard_Real tol = 1.e-4;
|
Standard_Real tol = Max(theTol, 1.e-4);
|
||||||
GeomAPI_ProjectPointOnSurf proj;
|
GeomAPI_ProjectPointOnSurf proj;
|
||||||
proj.Init(surface, U1, U2, V1, V2, tol);
|
proj.Init(surface, U1, U2, V1, V2, tol);
|
||||||
proj.Perform(thePoint);
|
proj.Perform(thePoint);
|
||||||
|
@ -222,11 +222,13 @@ namespace GEOMUtils
|
|||||||
* \param theFace the face shape
|
* \param theFace the face shape
|
||||||
* \param theU the output U parameter of the point on the face
|
* \param theU the output U parameter of the point on the face
|
||||||
* \param theV the output V parameter of the point on the face
|
* \param theV the output V parameter of the point on the face
|
||||||
|
* \param theTol the tolerance value. Maximum of theTol and 1e-04 will be used for calculation.
|
||||||
* \retval the projection (3d point) if found, throws an exception otherwise
|
* \retval the projection (3d point) if found, throws an exception otherwise
|
||||||
*/
|
*/
|
||||||
Standard_EXPORT gp_Pnt ProjectPointOnFace(const gp_Pnt& thePoint,
|
Standard_EXPORT gp_Pnt ProjectPointOnFace(const gp_Pnt& thePoint,
|
||||||
const TopoDS_Shape& theFace,
|
const TopoDS_Shape& theFace,
|
||||||
double& theU, double& theV);
|
double& theU, double& theV,
|
||||||
|
const double theTol = 1e-04);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the point clicked in 3D view.
|
* \brief Returns the point clicked in 3D view.
|
||||||
|
Loading…
Reference in New Issue
Block a user