mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0031203: SENR-21-037 SenerAlgo_ProjectWire fails when projecting wire to face (691 and 720)
This commit is contained in:
parent
77676f1b6d
commit
52a5d7a61d
@ -27,6 +27,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
static const Standard_Real Probing_Start = 0.123;
|
||||
static const Standard_Real Probing_End = 0.7;
|
||||
@ -45,6 +46,7 @@ BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
|
||||
myFace.Orientation(TopAbs_FORWARD);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPoint
|
||||
//purpose :
|
||||
@ -151,10 +153,12 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
if (Precision::IsPositiveInfinite(aLPar)) {
|
||||
aFPar = -1.;
|
||||
aLPar = 1.;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
aFPar = aLPar - 1.;
|
||||
}
|
||||
} else if (Precision::IsPositiveInfinite(aLPar))
|
||||
}
|
||||
else if (Precision::IsPositiveInfinite(aLPar))
|
||||
aLPar = aFPar + 1.;
|
||||
|
||||
for (; myCurEdgePar < Probing_End; myCurEdgePar += Probing_Step) {
|
||||
@ -174,8 +178,10 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
aTanVec /= Sqrt(aTanMod);
|
||||
Standard_Real aSinA = aTanVec.Crossed(aLinDir.XY());
|
||||
const Standard_Real SmallAngle = 0.001;
|
||||
Standard_Boolean isSmallAngle = Standard_False;
|
||||
if (Abs(aSinA) < SmallAngle)
|
||||
{
|
||||
isSmallAngle = Standard_True;
|
||||
// The line from the input point P to the current point on edge
|
||||
// is tangent to the edge curve. This condition is bad for classification.
|
||||
// Therefore try to go to another point in the hope that there will be
|
||||
@ -189,13 +195,47 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
|
||||
// Check if ends of a curve lie on a line.
|
||||
aC2d->D0(aFPar, aPOnC);
|
||||
|
||||
Standard_Real aFDist = P.SquareDistance(aPOnC);
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
aC2d->D0(aLPar, aPOnC);
|
||||
|
||||
if (L.SquareDistance(aPOnC) > aTolParConf2) {
|
||||
myCurEdgePar += Probing_Step;
|
||||
Standard_Real aLDist = P.SquareDistance(aPOnC);
|
||||
|
||||
if (isSmallAngle)
|
||||
{
|
||||
//Try to find minimal distance between curve and line
|
||||
|
||||
Geom2dAPI_ProjectPointOnCurve aProj;
|
||||
aProj.Init(P, aC2d, aFPar, aLPar);
|
||||
if (aProj.NbPoints() > 0)
|
||||
{
|
||||
Standard_Real aMinDist = aProj.LowerDistance();
|
||||
aMinDist *= aMinDist;
|
||||
Standard_Real aTMin = aProj.LowerDistanceParameter();
|
||||
if (aMinDist > aFDist)
|
||||
{
|
||||
aMinDist = aFDist;
|
||||
aTMin = aFPar;
|
||||
}
|
||||
if (aMinDist > aLDist)
|
||||
{
|
||||
aMinDist = aLDist;
|
||||
aTMin = aLPar;
|
||||
}
|
||||
if (aMinDist < Par)
|
||||
{
|
||||
Par = aMinDist;
|
||||
if (Par < aTolParConf2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aC2d->D1(aTMin, aPOnC, aTanVec);
|
||||
aLinDir.SetXY(aTanVec.XY());
|
||||
L = gp_Lin2d(P, aLinDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
myCurEdgePar += Probing_Step;
|
||||
if (myCurEdgePar >= Probing_End) {
|
||||
myCurEdgeInd++;
|
||||
myCurEdgePar = Probing_Start;
|
||||
|
Loading…
x
Reference in New Issue
Block a user