1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027896: Prm-Prm intersection algo returns wrong result if it is called with start intersection point, which lies in the domain boundary

Purger has been disabled (in IntPatch_PrmPrmIntersection algorithm) if some points have been added in the Walking line (it is stupidly, first, to insert some points in the line and, after that, to delete points from this line).

Some improvements in IntWalk_PWalking::SeekPointOnBoundary(...) method have been made (see comments in the code for detail information).

Some test cases have been adjusted according to their new behavior.
This commit is contained in:
nbv
2016-10-28 09:37:38 +03:00
committed by apn
parent a3d4053c15
commit f73c584ceb
10 changed files with 213 additions and 36 deletions

View File

@@ -1404,13 +1404,28 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
for (Standard_Integer i=1, aNbLin = slin.Length(); i<=aNbLin; i++)
{
Handle(IntPatch_Line)& aL = slin(i);
Handle(IntPatch_PointLine) aL = Handle(IntPatch_PointLine)::DownCast(slin(i));
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang);
if (aL->NbPnts() <= 2)
{
Standard_Boolean aCond = aL->NbPnts() < 2;
if (!aCond)
aCond = (aL->Point(1).IsSame(aL->Point(2), Precision::Confusion()));
if (aCond)
{
slin.Remove(i);
i--;
aNbLin--;
continue;
}
}
if(aL->ArcType() == IntPatch_Walking)
{
const Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(aL);

View File

@@ -2331,30 +2331,29 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//
Standard_Boolean bPWIsDone;
Standard_Integer iPWNbPoints, aNbPointsVer;
Standard_Real aD11, aD12, aD21, aD22, aDx;
//
bPWIsDone=PW.IsDone();
if(bPWIsDone)
{
iPWNbPoints=PW.NbPoints();
//
if( iPWNbPoints > 2 )
Standard_Boolean hasBeenAdded = Standard_False;
if(PW.NbPoints() > 2 )
{
//Try to extend the intersection line to boundary, if it is possibly
//Try to extend the intersection line to the boundary,
//if it is possibly
PW.PutToBoundary(Surf1, Surf2);
const Standard_Integer aMinNbPoints = 40;
if(iPWNbPoints < aMinNbPoints)
if(PW.NbPoints() < aMinNbPoints)
{
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
iPWNbPoints = PW.NbPoints();
hasBeenAdded = PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
}
Standard_Integer iPWNbPoints = PW.NbPoints(), aNbPointsVer = 0;
RejectLine = Standard_False;
Point3dDebut = PW.Value(1).Value();
Point3dFin = PW.Value(iPWNbPoints).Value();
Point3dFin = PW.Value(iPWNbPoints).Value();
for( ver = 1; (!RejectLine) && (ver<= NbLigCalculee); ++ver)
{
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
@@ -2450,6 +2449,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
wline->EnablePurging(!hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
if(wline->NbVertex() == 0)
@@ -2583,12 +2583,13 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if(PW.IsDone())
{
Standard_Boolean hasBeenAdded = Standard_False;
if(PW.NbPoints()>2)
{
const Standard_Integer aMinNbPoints = 40;
if(PW.NbPoints() < aMinNbPoints)
{
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
hasBeenAdded = PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
}
//-----------------------------------------------
@@ -2657,6 +2658,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
wline->EnablePurging(!hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);

View File

@@ -479,7 +479,7 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
//-- On detecte les points confondus dans la LineOn2S
Standard_Real dmini = Precision::Confusion();
dmini*=dmini;
for(i=2; i<=nbponline; i++) {
for(i=2; (i<=nbponline) && (nbponline > 2); i++) {
const IntSurf_PntOn2S& aPnt1=curv->Value(i-1);
const IntSurf_PntOn2S& aPnt2=curv->Value(i);
Standard_Real d = (aPnt1.Value()).SquareDistance((aPnt2.Value()));