1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0027434: Wrong result of classification of the point in "infinity"

In the case of infinite point due to not enough machine precision the distance from the point to each edge of the face is computed the same, and the algorithm cannot correctly select the nearest edge. To solve this problem checking of point was added, if the point is located too far from the bounding box of the face, then it will be replaced with another point located on the line between the point and the center of the bounding box.
    The new point has the same state as initial one but its state can be resolved without ambiguity.

Corrections in CheckPoint method
Small correction of test case for issue CR27434
This commit is contained in:
aka
2016-12-08 16:33:47 +03:00
committed by apn
parent 8013367c92
commit a148c938b0
6 changed files with 103 additions and 6 deletions

View File

@@ -25,7 +25,10 @@
//purpose :
//=======================================================================
TopClass_FaceClassifier::TopClass_FaceClassifier()
TopClass_FaceClassifier::TopClass_FaceClassifier() :
myEdgeParameter(0.0),
rejected(Standard_False),
nowires(Standard_True)
{
}
@@ -36,7 +39,10 @@ TopClass_FaceClassifier::TopClass_FaceClassifier()
TopClass_FaceClassifier::TopClass_FaceClassifier(TheFaceExplorer& FExp,
const gp_Pnt2d& P,
const Standard_Real Tol)
const Standard_Real Tol) :
myEdgeParameter(0.0),
rejected(Standard_False),
nowires(Standard_True)
{
Perform(FExp,P,Tol);
}
@@ -50,15 +56,22 @@ void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
const gp_Pnt2d& P,
const Standard_Real Tol)
{
gp_Pnt2d aPoint(P);
Standard_Boolean aResOfPointCheck = Standard_False;
while (aResOfPointCheck == Standard_False)
{
aResOfPointCheck = Fexp.CheckPoint(aPoint);
}
// Test for rejection.
rejected = Fexp.Reject(P);
rejected = Fexp.Reject(aPoint);
if (rejected)
return;
gp_Lin2d aLine;
Standard_Real aParam;
Standard_Boolean IsValidSegment = Fexp.Segment(P, aLine, aParam);
Standard_Boolean IsValidSegment = Fexp.Segment(aPoint, aLine, aParam);
TheEdge anEdge;
TopAbs_Orientation anEdgeOri;
Standard_Integer aClosestInd;
@@ -135,7 +148,7 @@ void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
break;
// Bad case for classification. Trying to get another segment.
IsValidSegment = Fexp.OtherSegment(P, aLine, aParam);
IsValidSegment = Fexp.OtherSegment(aPoint, aLine, aParam);
}
}