1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
nbv
1ef09cebff Purger is switched off. 2017-03-20 09:35:37 +03:00
nbv
2f9c147b09 0023914: Intersection algorithm produced too many intersection points
This is draft version.

1. External step limitation has been eliminated.
2. Interfaces of GeomInt_IntSS, IntPatch_Intersection and IntPatch_PrmPrmIntersection classes has been changed.
3. Syntax of "intersect" DRAW-command has been changed (see help for detail information).
4. New statuses have been added in IntWalk_StatusDeflection.hxx file.

Main changes are made in IntWalk_PWalking class.

Creation of test case for this issue.
2017-03-17 17:25:04 +03:00
21 changed files with 1075 additions and 2306 deletions

View File

@@ -3319,15 +3319,14 @@ Standard_Boolean ChFi3d_ComputeCurves(const Handle(Adaptor3d_HSurface)& S1,
// At this stage :
// classic intersections have failed, the path is approached in vain.
Standard_Real Step = 0.1;
for(;;) {
for(Standard_Integer aNbIter = 20;;) {
//Attention the parameters of arrow for the path and
//the tolerance for the approximation can't be taken as those of the
//Builder, so they are reestimated as much as possible.
Standard_Real fleche = 1.e-3 * pdeb.Distance(pfin);
Standard_Real tolap = 1.e-7;
IntWalk_PWalking
IntKK(S1,S2,tol3d,tol3d,fleche,Step);
IntKK(S1,S2,tol3d,tol3d,fleche);
//The extremities of the intersection (Pardeb,Parfin) are known,
//one tries to find the start point at the
@@ -3351,8 +3350,7 @@ Standard_Boolean ChFi3d_ComputeCurves(const Handle(Adaptor3d_HSurface)& S1,
IntKK.Perform(depart);
if (!IntKK.IsDone()) return Standard_False;
if (IntKK.NbPoints() <= 30) {
Step *= 0.5;
if (Step <= 0.0001) {
if (--aNbIter <= 0) {
return Standard_False;
}
}

View File

@@ -82,16 +82,16 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
Standard_Real TolArc = Tol;
Standard_Real TolTang = Tol;
Standard_Real UVMaxStep = 0.001;
Standard_Real Deflection = 0.1;
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
myIntersector.SetTolerances(TolArc,TolTang,Deflection);
if(myHS1 == myHS2) {
myIntersector.Perform(myHS1,dom1,TolArc,TolTang);
}
else if (!useStart) {
myIntersector.Perform(myHS1,dom1,myHS2,dom2,TolArc,TolTang);
myIntersector.Perform(myHS1, dom1, myHS2, dom2,
TolArc,TolTang,Standard_True, Standard_False);
}
else {
myIntersector.Perform(myHS1,dom1,myHS2,dom2,U1,V1,U2,V2,TolArc,TolTang);

View File

@@ -1496,11 +1496,40 @@ static Standard_Integer intersection (Draw_Interpretor& di,
if (GS2.IsNull())
return 1;
//
Handle(GeomAdaptor_HSurface) AS1,AS2;
Standard_Real tol = Precision::Confusion();
if (n == 5 || n == 9 || n == 13 || n == 17)
tol = Draw::Atof(a[n-1]);
Standard_Real UVsta[4];
Standard_Boolean useStart = Standard_False, useBnd = Standard_False;
for(Standard_Integer i = 4; i < n; i++)
{
if(!strcmp(a[i], "-sp"))
{
useStart = Standard_True;
for(Standard_Integer j = 0; j < 4; j++)
{
UVsta[j] = Draw::Atof(a[++i]);
}
}
if(!strcmp(a[i], "-b"))
{
Standard_Real UVbnd[8];
useBnd = Standard_True;
for(Standard_Integer j = 0; j < 4; j++)
{
UVbnd[j] = Draw::Atof(a[++i]);
}
AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]);
AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]);
}
if(!strcmp(a[i], "-t"))
{
tol = Draw::Atof(a[++i]);
}
}
//
Handle(Geom_Curve) Result;
gp_Pnt Point;
@@ -1509,76 +1538,24 @@ static Standard_Integer intersection (Draw_Interpretor& di,
if (GC1.IsNull())
{
GeomInt_IntSS Inters;
//
// Surface Surface
if (n <= 5)
if(!useStart && !useBnd)
{
// General case
Inters.Perform(GS1,GS2,tol,Standard_True);
Inters.Perform(GS1,GS2,tol,Standard_True, Standard_False, Standard_False);
}
else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
else if (useStart && !useBnd)
{
Standard_Boolean useStart = Standard_True, useBnd = Standard_True;
Standard_Integer ista1=0,ista2=0,ibnd1=0,ibnd2=0;
Standard_Real UVsta[4];
Handle(GeomAdaptor_HSurface) AS1,AS2;
//
if (n <= 9) // user starting point
{
useBnd = Standard_False;
ista1 = 4;
ista2 = 7;
}
else if (n <= 13) // user bounding
{
useStart = Standard_False;
ibnd1 = 4; ibnd2 = 11;
}
else // both user starting point and bounding
{
ista1 = 4; ista2 = 7;
ibnd1 = 8; ibnd2 = 15;
}
if (useStart)
{
for (Standard_Integer i=ista1; i <= ista2; i++)
{
UVsta[i-ista1] = Draw::Atof(a[i]);
}
}
if (useBnd)
{
Standard_Real UVbnd[8];
for (Standard_Integer i=ibnd1; i <= ibnd2; i++)
UVbnd[i-ibnd1] = Draw::Atof(a[i]);
AS1 = new GeomAdaptor_HSurface(GS1,UVbnd[0],UVbnd[1],UVbnd[2],UVbnd[3]);
AS2 = new GeomAdaptor_HSurface(GS2,UVbnd[4],UVbnd[5],UVbnd[6],UVbnd[7]);
}
//
if (useStart && !useBnd)
{
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
else if (!useStart && useBnd)
{
Inters.Perform(AS1,AS2,tol);
}
else
{
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3]);
}
}//else if (n == 8 || n == 9 || n == 12 || n == 13 || n == 16 || n == 17)
Inters.Perform(GS1,GS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3], Standard_True, Standard_False, Standard_False);
}
else if (!useStart && useBnd)
{
Inters.Perform(AS1,AS2,tol,Standard_True, Standard_False, Standard_False);
}
else
{
di<<"incorrect number of arguments\n";
return 1;
Inters.Perform(AS1,AS2,tol,UVsta[0],UVsta[1],UVsta[2],UVsta[3], Standard_True, Standard_False, Standard_False);
}
//
if (!Inters.IsDone())
{
@@ -1798,8 +1775,9 @@ void GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
g = "GEOMETRY intersections";
theCommands.Add("intersect",
"intersect result surf1/curv1 surf2 [tolerance]\n\t\t "
"intersect result surf1 surf2 [u1 v1 u2 v2] [U1F U1L V1F V1L U2F U2L V2F V2L] [tolerance]",
"intersect result surf1 surf2 [-sp u1 v1 u2 v2] [-b U1F U1L V1F V1L U2F U2L V2F V2L] [-t tolerance] [-npp] : "
"Use:\n -sp option for setting start point;\n -b option for setting bounds;\n "
"-t option for setting tolerance;\n",
__FILE__,
intersection,g);

View File

@@ -580,7 +580,6 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
aWLine->ComputeVertexParameters(myTol3D);
aWLine->EnablePurging(Standard_False);
theLines.Append(aWLine);
}//while(aParameter < theLPar)
}

View File

@@ -47,7 +47,7 @@ IntPatch_Intersection::IntPatch_Intersection ()
: done(Standard_False),
//empt, tgte, oppo,
myTolArc(0.0), myTolTang(0.0),
myUVMaxStep(0.0), myFleche(0.0),
myFleche(0.0),
myIsStartPnt(Standard_False)
//myU1Start, myV1Start, myU2Start, myV2Start
{
@@ -65,7 +65,7 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_HSurface)&
: done(Standard_False),
//empt, tgte, oppo,
myTolArc(TolArc), myTolTang(TolTang),
myUVMaxStep(0.0), myFleche(0.0),
myFleche(0.0),
myIsStartPnt(Standard_False)
//myU1Start, myV1Start, myU2Start, myV2Start
{
@@ -86,7 +86,7 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_HSurface)&
: done(Standard_False),
//empt, tgte, oppo,
myTolArc(TolArc), myTolTang(TolTang),
myUVMaxStep(0.0), myFleche(0.0),
myFleche(0.0),
myIsStartPnt(Standard_False)
//myU1Start, myV1Start, myU2Start, myV2Start
{
@@ -98,21 +98,17 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_HSurface)&
//======================================================================
void IntPatch_Intersection::SetTolerances(const Standard_Real TolArc,
const Standard_Real TolTang,
const Standard_Real UVMaxStep,
const Standard_Real Fleche)
{
myTolArc = TolArc;
myTolTang = TolTang;
myUVMaxStep = UVMaxStep;
myFleche = Fleche;
if(myTolArc<1e-8) myTolArc=1e-8;
if(myTolTang<1e-8) myTolTang=1e-8;
if(myTolArc>0.5) myTolArc=0.5;
if(myTolTang>0.5) myTolTang=0.5;
if(myFleche<1.0e-3) myFleche=1e-3;
if(myUVMaxStep<1.0e-3) myUVMaxStep=1e-3;
if(myFleche>10) myFleche=10;
if(myUVMaxStep>0.5) myUVMaxStep=0.5;
}
//======================================================================
@@ -126,7 +122,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
myTolArc = TolArc;
myTolTang = TolTang;
if(myFleche == 0.0) myFleche = 0.01;
if(myUVMaxStep==0.0) myUVMaxStep = 0.01;
done = Standard_True;
spnt.Clear();
@@ -169,7 +164,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
default:
{
IntPatch_PrmPrmIntersection interpp;
interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(S1,D1,TolTang,TolArc,myFleche);
if (interpp.IsDone())
{
done = Standard_True;
@@ -739,15 +734,12 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
const Standard_Real TolArc,
const Standard_Real TolTang,
const Standard_Boolean isGeomInt,
const Standard_Boolean theIsReqToKeepRLine,
const Standard_Boolean theIsReqToPostWLProc)
const Standard_Boolean theIsReqToKeepRLine)
{
myTolArc = TolArc;
myTolTang = TolTang;
if(myFleche <= Precision::PConfusion())
myFleche = 0.01;
if(myUVMaxStep <= Precision::PConfusion())
myUVMaxStep = 0.01;
done = Standard_False;
spnt.Clear();
@@ -963,29 +955,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc,
TolTang, ListOfPnts, RestrictLine, typs1, typs2);
}
if(!theIsReqToPostWLProc)
return;
for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++)
{
Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i));
if(aWL.IsNull())
continue;
if (!aWL->IsPurgingAllowed())
continue;
Handle(IntPatch_WLine) aRW =
IntPatch_WLineTool::ComputePurgedWLine(aWL, theS1, theS2, theD1, theD2, RestrictLine);
if(aRW.IsNull())
continue;
slin.InsertAfter(i, aRW);
slin.Remove(i);
}
}
//=======================================================================
@@ -1001,15 +970,12 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
IntSurf_ListOfPntOn2S& ListOfPnts,
const Standard_Boolean RestrictLine,
const Standard_Boolean isGeomInt,
const Standard_Boolean theIsReqToKeepRLine,
const Standard_Boolean theIsReqToPostWLProc)
const Standard_Boolean theIsReqToKeepRLine)
{
myTolArc = TolArc;
myTolTang = TolTang;
if(myFleche <= Precision::PConfusion())
myFleche = 0.01;
if(myUVMaxStep <= Precision::PConfusion())
myUVMaxStep = 0.01;
done = Standard_False;
spnt.Clear();
@@ -1199,29 +1165,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc,
TolTang, ListOfPnts, RestrictLine, typs1, typs2, theIsReqToKeepRLine);
}
if(!theIsReqToPostWLProc)
return;
for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++)
{
Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i));
if(aWL.IsNull())
continue;
if(!aWL->IsPurgingAllowed())
continue;
Handle(IntPatch_WLine) aRW =
IntPatch_WLineTool::ComputePurgedWLine(aWL, theS1, theS2, theD1, theD2, RestrictLine);
if(aRW.IsNull())
continue;
slin.InsertAfter(i, aRW);
slin.Remove(i);
}
}
//=======================================================================
@@ -1245,10 +1188,10 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
Standard_Boolean ClearFlag = Standard_True;
if(!ListOfPnts.IsEmpty())
{
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche, ListOfPnts, RestrictLine);
ClearFlag = Standard_False;
}
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!!
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,ClearFlag); //double call!!!!!!!
}
else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()))
{
@@ -1261,7 +1204,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS);
interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche);
}
else
{
@@ -1271,7 +1214,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS);
interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep);
interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche);
}
}//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())
else
@@ -1310,7 +1253,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
Handle(Adaptor3d_HSurface) nS1 = theS1;
Handle(Adaptor3d_HSurface) nS2 = theS2;
FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2);
interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche);
}// 'NON - COLLINEAR LINES'
}// both domains are infinite
@@ -1388,11 +1331,6 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
}
else
{
if (line->ArcType() == IntPatch_Walking)
{
Handle(IntPatch_WLine)::DownCast(line)->EnablePurging(Standard_False);
}
if((line->ArcType() != IntPatch_Restriction) || theIsReqToKeepRLine)
slin.Append(line);
}
@@ -1505,11 +1443,11 @@ void IntPatch_Intersection::
Handle(Adaptor3d_HSurface) nS1 = theS1;
Handle(Adaptor3d_HSurface) nS2 = theS2;
FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+5,nS1,nS2);
interip.Perform(nS1,theD1,nS2,theD2,myTolArc,myTolTang,myFleche,myUVMaxStep);
interip.Perform(nS1,theD1,nS2,theD2,myTolArc,myTolTang,myFleche, 0.001);
}
}
else
interip.Perform(theS1,theD1,theS2,theD2,myTolArc,myTolTang,myFleche,myUVMaxStep);
interip.Perform(theS1,theD1,theS2,theD2,myTolArc,myTolTang,myFleche, 0.001);
if (interip.IsDone())
{
@@ -1557,13 +1495,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
#endif
myFleche = 0.01;
}
if(myUVMaxStep==0.0) {
#if DEBUG
//cout<<" -- IntPatch_Intersection::myUVMaxStep fixe par defaut a 0.01 --"<<endl;
//cout<<" -- Utiliser la Methode SetTolerances( ... ) "<<endl;
#endif
myUVMaxStep = 0.01;
}
done = Standard_False;
spnt.Clear();
@@ -1593,7 +1524,7 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
else
{
IntPatch_PrmPrmIntersection interpp;
interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche,myUVMaxStep);
interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche);
if (interpp.IsDone())
{
done = Standard_True;
@@ -1604,26 +1535,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
for (; i<=nblm; i++) slin.Append(interpp.Line(i));
}
}
for(Standard_Integer i = slin.Lower(); i <= slin.Upper(); i++)
{
Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(slin.Value(i));
if(aWL.IsNull())
continue;
if (!aWL->IsPurgingAllowed())
continue;
Handle(IntPatch_WLine) aRW =
IntPatch_WLineTool::ComputePurgedWLine(aWL, S1, S2, D1, D2, Standard_True);
if(aRW.IsNull())
continue;
slin.InsertAfter(i, aRW);
slin.Remove(i);
}
}
#ifdef DUMPOFIntPatch_Intersection

View File

@@ -71,7 +71,7 @@ public:
//! UVMaxStep is a parameter used in the walking
//! algorithms to compute the distance between to
//! points in their respective parametrtic spaces.
Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real UVMaxStep, const Standard_Real Fleche);
Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real Fleche);
//! Flag theIsReqToKeepRLine has been enterred only for
//! compatibility with TopOpeBRep package. It shall be deleted
@@ -84,7 +84,7 @@ public:
//! after deleting TopOpeBRep.
//! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
//! obtained after intersection algorithm directly (wothout any post-processing).
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
//! If isGeomInt == Standard_False, then method
//! Param-Param intersection will be used.
@@ -99,7 +99,7 @@ public:
//! after deleting TopOpeBRep.
//! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
//! obtained after intersection algorithm directly (wothout any post-processing).
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine = Standard_True, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine = Standard_True, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
//! Perform with start point
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolArc, const Standard_Real TolTang);
@@ -178,7 +178,6 @@ private:
IntPatch_SequenceOfLine slin;
Standard_Real myTolArc;
Standard_Real myTolTang;
Standard_Real myUVMaxStep;
Standard_Real myFleche;
Standard_Boolean myIsStartPnt;
Standard_Real myU1Start;

View File

@@ -313,11 +313,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& S
const Handle(Adaptor3d_TopolTool)& D1,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
IntPatch_Polyhedron Poly1( Surf1, D1->NbSamplesU(), D1->NbSamplesV() );
Perform( Surf1, Poly1, D1, TolTangency, Epsilon, Deflection, Increment );
Perform( Surf1, Poly1, D1, TolTangency, Epsilon, Deflection);
}
//==================================================================================
@@ -331,11 +330,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& S
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
IntPatch_Polyhedron Poly2( Surf2 );
Perform( Surf1, Poly1, D1, Surf2, Poly2, D2, TolTangency, Epsilon, Deflection, Increment);
Perform( Surf1, Poly1, D1, Surf2, Poly2, D2, TolTangency, Epsilon, Deflection);
}
//==================================================================================
@@ -349,11 +347,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& S
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
IntPatch_Polyhedron Poly1( Surf1 );
Perform( Surf1, Poly1, D1, Surf2, Poly2, D2, TolTangency, Epsilon, Deflection, Increment );
Perform( Surf1, Poly1, D1, Surf2, Poly2, D2, TolTangency, Epsilon, Deflection);
}
//==================================================================================
@@ -368,8 +365,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
IntPatch_InterferencePolyhedron Interference(Poly1,Poly2);
empt = Standard_True;
@@ -386,13 +382,11 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
TColStd_Array1OfReal StartParams(1,4);
IntWalk_PWalking PW( Surf1, Surf2, TolTangency, Epsilon, Deflection, Increment );
IntWalk_PWalking PW( Surf1, Surf2, TolTangency, Epsilon, Deflection);
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant
Standard_Real incidence;
Standard_Real dminiPointLigne;
Standard_Boolean HasStartPoint,RejetLigne;
Standard_Real SeuildPointLigne = 4.0*PW.MaxStep(); //-- 10 est insuffisant
Standard_Real incidence, dminiPointLigne;
Standard_Boolean HasStartPoint, RejetLigne;
IntSurf_PntOn2S StartPOn2S;
@@ -400,6 +394,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
gp_Pnt Point3dDebut,Point3dFin;
SeuildPointLigne *= SeuildPointLigne;
if( nbLigSec >= 1 ) {
Standard_Integer *TabL = new Standard_Integer [nbLigSec+1];
Standard_Integer ls;
@@ -775,8 +771,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
const Handle(Adaptor3d_TopolTool)& D1,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
IntPatch_InterferencePolyhedron Interference(Poly1);
empt = Standard_True;
@@ -793,9 +788,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
Standard_Real pu1,pu2,pv1,pv2;
TColStd_Array1OfReal StartParams(1,4);
IntWalk_PWalking PW(Surf1,Surf1,TolTangency,Epsilon,Deflection,Increment);
IntWalk_PWalking PW(Surf1,Surf1,TolTangency,Epsilon,Deflection);
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant
Standard_Real SeuildPointLigne = 4.0*PW.MaxStep(); //-- 10 est insuffisant
Standard_Real incidence;
Standard_Real dminiPointLigne;
@@ -806,6 +801,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
Standard_Integer ver;
gp_Pnt Point3dDebut,Point3dFin;
SeuildPointLigne *= SeuildPointLigne;
if(nbLigSec>=1) {
Standard_Integer ls;
@@ -1245,7 +1241,7 @@ Handle(IntPatch_Line) IntPatch_PrmPrmIntersection::NewLine (const Handle(Adaptor
V2(Low) = v2;
AC(Low) =0.0;
IntWalk_PWalking PW(Surf1,Surf2,0.000001,0.000001,0.001,0.001);
IntWalk_PWalking PW(Surf1,Surf2,0.000001,0.000001,0.001);
Standard_Integer i;
for(i=Low+1; i<=High; i++)
@@ -1534,7 +1530,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment,
IntSurf_ListOfPntOn2S& LOfPnts,
const Standard_Boolean RestrictLine)
{
@@ -1675,7 +1670,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
if(V2<VminLig2) VminLig2=V2;
}
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment;
Standard_Integer NbLigCalculee = 0, ver;
Standard_Real pu1,pu2,pv1,pv2, dminiPointLigne;
@@ -1684,7 +1678,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
gp_Pnt Point3dDebut,Point3dFin;
TColStd_Array1OfReal StartParams(1,4);
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment);
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection);
Standard_Real SeuildPointLigne = 4.0 * PW.MaxStep();
SeuildPointLigne *= SeuildPointLigne;
IntSurf_ListIteratorOfListOfPntOn2S IterLOP2(LOfPnts);
for(; IterLOP2.More(); IterLOP2.Next() ){
@@ -1795,8 +1791,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
}
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
TolTang, Max(PW.Step(0), PW.Step(1)),
Max(PW.Step(2), PW.Step(3)), wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
@@ -1823,8 +1819,7 @@ void IntPatch_PrmPrmIntersection::Perform(const Handle(Adaptor3d_HSurface)& S
const Standard_Real V2Depart,
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment)
const Standard_Real Deflection)
{
// Standard_Integer NbU1 = D1->NbSamplesU();
// Standard_Integer NbV1 = D1->NbSamplesV();
@@ -1858,8 +1853,7 @@ void IntPatch_PrmPrmIntersection::Perform(const Handle(Adaptor3d_HSurface)& S
IntWalk_PWalking PW(Surf1,Surf2,
TolTangency,
Epsilon,
Deflection,
Increment); //nIncrement);
Deflection); //nIncrement);
//Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant
@@ -2098,7 +2092,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment,
const Standard_Boolean ClearFlag)
{
Standard_Integer Limit = 2500;
@@ -2169,7 +2162,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Integer nbLigSec = Interference.NbSectionLines();
Standard_Integer nbTanZon = Interference.NbTangentZones();
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment;
Standard_Integer NbLigCalculee = 0, ver;
Standard_Real pu1,pu2,pv1,pv2, incidence, dminiPointLigne;
@@ -2178,7 +2170,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
gp_Pnt Point3dDebut,Point3dFin;
TColStd_Array1OfReal StartParams(1,4);
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment);
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection);
Standard_Real SeuildPointLigne = 4.0 * PW.MaxStep();
SeuildPointLigne *= SeuildPointLigne;
if(nbLigSec>=1)
{
@@ -2337,7 +2331,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if(bPWIsDone)
{
Standard_Boolean hasBeenAdded = Standard_False;
if(PW.NbPoints() > 2 )
{
//Try to extend the intersection line to the boundary,
@@ -2345,10 +2338,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PW.PutToBoundary(Surf1, Surf2);
const Standard_Integer aMinNbPoints = 40;
if(PW.NbPoints() < aMinNbPoints)
{
hasBeenAdded = PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
}
//if(PW.NbPoints() < aMinNbPoints)
//{
// PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
//}
Standard_Integer iPWNbPoints = PW.NbPoints(), aNbPointsVer = 0;
RejectLine = Standard_False;
@@ -2449,7 +2442,6 @@ 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)
@@ -2473,8 +2465,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
lignetrouvee = Standard_True;
SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
TolTang, Max(PW.Step(0), PW.Step(1)),
Max(PW.Step(2), PW.Step(3)), wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
@@ -2583,14 +2575,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)
{
hasBeenAdded = PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
}
//const Standard_Integer aMinNbPoints = 40;
//if(PW.NbPoints() < aMinNbPoints)
//{
// PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
//}
//-----------------------------------------------
//-- Verification a posteriori :
@@ -2658,7 +2649,6 @@ 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);
@@ -2721,12 +2711,14 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if(MaxOscill < NbV1) MaxOscill=NbV1;
if(MaxOscill < NbV2) MaxOscill=NbV2;
Standard_Real nIncrement=Increment;
//Standard_Real nIncrement=Increment;
//if(MaxOscill>10)
//nIncrement/=0.5*MaxOscill;
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,nIncrement);
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment; //-- 10 est insuffisant
IntWalk_PWalking PW(Surf1,Surf2,TolTangency,Epsilon,Deflection);
Standard_Real SeuildPointLigne = 4.0 * PW.MaxStep(); //-- 10 est insuffisant
SeuildPointLigne *= SeuildPointLigne;
Standard_Real dminiPointLigne;
Standard_Boolean HasStartPoint,RejetLigne;
IntSurf_PntOn2S StartPOn2S;

View File

@@ -56,29 +56,29 @@ public:
//! Performs the intersection between <Caro1> and
//! <Caro2>. Associated Polyhedrons <Polyhedron1>
//! and <Polyhedron2> are given.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Performs the intersection between <Caro1> and
//! <Caro2>. The method computes the polyhedron on
//! each surface.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, const Standard_Boolean ClearFlag = Standard_True);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Boolean ClearFlag = Standard_True);
//! Performs the intersection between <Caro1> and
//! <Caro2>. The method computes the polyhedron on
//! each surface.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, IntSurf_ListOfPntOn2S& ListOfPnts, const Standard_Boolean RestrictLine);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, IntSurf_ListOfPntOn2S& ListOfPnts, const Standard_Boolean RestrictLine);
//! Performs the intersection between <Caro1> and
//! <Caro2>. The method computes the polyhedron on
//! each surface.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Performs the intersection between <Caro1> and
//! <Caro2>. The method computes the polyhedron on
//! each surface.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Performs the intersection between <Caro1> and
//! <Caro2>.
@@ -86,7 +86,7 @@ public:
//! The polyhedron which approximates <Caro2>,
//! <Polyhedron2> is given. The other one is
//! computed.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Performs the intersection between <Caro1> and
//! <Caro2>.
@@ -94,7 +94,7 @@ public:
//! The polyhedron which approximates <Caro1>,
//! <Polyhedron1> is given. The other one is
//! computed.
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Returns true if the calculus was succesfull.
Standard_Boolean IsDone() const;

View File

@@ -41,8 +41,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_PointLine(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
myIsPurgerAllowed(Standard_True)
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
curv = Line;
@@ -58,8 +57,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_PointLine(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
myIsPurgerAllowed(Standard_True)
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
curv = Line;
@@ -73,8 +71,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean Tang) :
IntPatch_PointLine(Tang),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
myIsPurgerAllowed(Standard_True)
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
curv = Line;

View File

@@ -171,19 +171,6 @@ public:
//! Otherwise, prints list of 2d-points on the 2nd surface
Standard_EXPORT void Dump(const Standard_Integer theMode) const;
//! Allows or forbides purging of existing WLine
void EnablePurging(const Standard_Boolean theIsEnabled)
{
myIsPurgerAllowed = theIsEnabled;
}
//! Returns TRUE if purging is allowed or forbiden for existing WLine
Standard_Boolean IsPurgingAllowed()
{
return myIsPurgerAllowed;
}
DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine)
protected:
@@ -192,8 +179,6 @@ protected:
private:
Handle(IntSurf_LineOn2S) curv;
Standard_Boolean fipt;
Standard_Boolean lapt;
@@ -211,9 +196,6 @@ private:
Handle(Adaptor2d_HCurve2d) theArcOnS1;
Standard_Boolean hasArcOnS2;
Handle(Adaptor2d_HCurve2d) theArcOnS2;
Standard_Boolean myIsPurgerAllowed;
};

View File

@@ -58,431 +58,6 @@ static inline void MinMax(Standard_Real& theParMIN, Standard_Real& theParMAX)
}
}
//=========================================================================
// function : FillPointsHash
// purpose : Fill points hash by input data.
// Static subfunction in ComputePurgedWLine.
//=========================================================================
static void FillPointsHash(const Handle(IntPatch_WLine) &theWLine,
NCollection_Array1<Standard_Integer> &thePointsHash)
{
// 1 - Delete point.
// 0 - Store point.
// -1 - Vertex point (not delete).
Standard_Integer i, v;
for(i = 1; i <= theWLine->NbPnts(); i++)
thePointsHash.SetValue(i, 0);
for(v = 1; v <= theWLine->NbVertex(); v++)
{
IntPatch_Point aVertex = theWLine->Vertex(v);
Standard_Integer avertexindex = (Standard_Integer)aVertex.ParameterOnLine();
thePointsHash.SetValue(avertexindex, -1);
}
}
//=========================================================================
// function : MakeNewWLine
// purpose : Makes new walking line according to the points hash
// Static subfunction in ComputePurgedWLine and DeleteOuter.
//=========================================================================
static Handle(IntPatch_WLine) MakeNewWLine(const Handle(IntPatch_WLine) &theWLine,
const NCollection_Array1<Standard_Integer> &thePointsHash)
{
Standard_Integer i;
Handle(IntSurf_LineOn2S) aPurgedLineOn2S = new IntSurf_LineOn2S();
Handle(IntPatch_WLine) aLocalWLine = new IntPatch_WLine(aPurgedLineOn2S, Standard_False);
Standard_Integer anOldLineIdx = 1, aVertexIdx = 1;
for(i = 1; i <= thePointsHash.Upper(); i++)
{
if (thePointsHash(i) == 0)
{
// Store this point.
aPurgedLineOn2S->Add(theWLine->Point(i));
anOldLineIdx++;
}
else if (thePointsHash(i) == -1)
{
// Add vertex.
IntPatch_Point aVertex = theWLine->Vertex(aVertexIdx++);
aVertex.SetParameter(anOldLineIdx++);
aLocalWLine->AddVertex(aVertex);
aPurgedLineOn2S->Add(theWLine->Point(i));
}
}
return aLocalWLine;
}
//=========================================================================
// function : MovePoint
// purpose : Move point into surface param space. No interpolation used
// because walking algorithm should care for closeness to the param space.
// Static subfunction in ComputePurgedWLine.
//=========================================================================
static void MovePoint(const Handle(Adaptor3d_HSurface) &theS1,
Standard_Real &U1, Standard_Real &V1)
{
if (U1 < theS1->FirstUParameter())
U1 = theS1->FirstUParameter();
if (U1 > theS1->LastUParameter())
U1 = theS1->LastUParameter();
if (V1 < theS1->FirstVParameter())
V1 = theS1->FirstVParameter();
if (V1 > theS1->LastVParameter())
V1 = theS1->LastVParameter();
}
//=========================================================================
// function : DeleteOuterPoints
// purpose : Check and delete out of bounds points on walking line.
// Static subfunction in ComputePurgedWLine.
//=========================================================================
static Handle(IntPatch_WLine)
DeleteOuterPoints(const Handle(IntPatch_WLine) &theWLine,
const Handle(Adaptor3d_HSurface) &theS1,
const Handle(Adaptor3d_HSurface) &theS2,
const Handle(Adaptor3d_TopolTool) &theDom1,
const Handle(Adaptor3d_TopolTool) &theDom2)
{
Standard_Integer i;
NCollection_Array1<Standard_Integer> aDelOuterPointsHash(1, theWLine->NbPnts());
FillPointsHash(theWLine, aDelOuterPointsHash);
if (theS1->IsUPeriodic() || theS1->IsVPeriodic() ||
theS2->IsUPeriodic() || theS2->IsVPeriodic() )
return theWLine;
gp_Pnt2d aPntOnF1, aPntOnF2;
Standard_Real aX1, aY1, aX2, aY2;
// Iterate over points in walking line and delete which are out of bounds.
// Forward.
Standard_Boolean isAllDeleted = Standard_True;
Standard_Boolean aChangedFirst = Standard_False;
Standard_Integer aFirstGeomIdx = 1;
for(i = 1; i <= theWLine->NbPnts(); i++)
{
theWLine->Point(i).Parameters(aX1, aY1, aX2, aY2);
aPntOnF1.SetCoord(aX1, aY1);
aPntOnF2.SetCoord(aX2, aY2);
TopAbs_State aState1 = theDom1->Classify(aPntOnF1, Precision::Confusion());
TopAbs_State aState2 = theDom2->Classify(aPntOnF2, Precision::Confusion());
if (aState1 == TopAbs_OUT ||
aState2 == TopAbs_OUT )
{
aDelOuterPointsHash(i) = 1;
aChangedFirst = Standard_True;
}
else
{
isAllDeleted = Standard_False;
aFirstGeomIdx = Max (i - 1, 1);
if (aDelOuterPointsHash(i) == -1)
aFirstGeomIdx = i; // Use data what lies in (i) point / vertex.
aDelOuterPointsHash(i) = -1;
break;
}
}
if (isAllDeleted)
{
// ALL points are out of bounds:
// case boolean bcut_complex F5 and similar.
return theWLine;
}
// Backward.
Standard_Boolean aChangedLast = Standard_False;
Standard_Integer aLastGeomIdx = theWLine->NbPnts();
for(i = theWLine->NbPnts(); i >= 1; i--)
{
theWLine->Point(i).Parameters(aX1, aY1, aX2, aY2);
aPntOnF1.SetCoord(aX1, aY1);
aPntOnF2.SetCoord(aX2, aY2);
TopAbs_State aState1 = theDom1->Classify(aPntOnF1, Precision::Confusion());
TopAbs_State aState2 = theDom2->Classify(aPntOnF2, Precision::Confusion());
if (aState1 == TopAbs_OUT ||
aState2 == TopAbs_OUT )
{
aDelOuterPointsHash(i) = 1;
aChangedLast = Standard_True; // Move vertex to first good point
}
else
{
aLastGeomIdx = Min (i + 1, theWLine->NbPnts());
if (aDelOuterPointsHash(i) == -1)
aLastGeomIdx = i; // Use data what lies in (i) point / vertex.
aDelOuterPointsHash(i) = -1;
break;
}
}
if (!aChangedFirst && !aChangedLast)
{
// Nothing is done, return input.
return theWLine;
}
// Build new line and modify geometry of necessary vertexes.
Handle(IntPatch_WLine) aLocalWLine = MakeNewWLine(theWLine, aDelOuterPointsHash);
if (aChangedFirst)
{
// Vertex geometry.
IntPatch_Point aVertex = aLocalWLine->Vertex(1);
aVertex.SetValue(theWLine->Point(aFirstGeomIdx).Value());
Standard_Real aU1, aU2, aV1, aV2;
theWLine->Point(aFirstGeomIdx).Parameters(aU1, aV1, aU2, aV2);
MovePoint(theS1, aU1, aV1);
MovePoint(theS2, aU2, aV2);
aVertex.SetParameters(aU1, aV1, aU2, aV2);
aLocalWLine->Replace(1, aVertex);
// Change point in walking line.
aLocalWLine->SetPoint(1, aVertex);
}
if (aChangedLast)
{
// Vertex geometry.
IntPatch_Point aVertex = aLocalWLine->Vertex(aLocalWLine->NbVertex());
aVertex.SetValue(theWLine->Point(aLastGeomIdx).Value());
Standard_Real aU1, aU2, aV1, aV2;
theWLine->Point(aLastGeomIdx).Parameters(aU1, aV1, aU2, aV2);
MovePoint(theS1, aU1, aV1);
MovePoint(theS2, aU2, aV2);
aVertex.SetParameters(aU1, aV1, aU2, aV2);
aLocalWLine->Replace(aLocalWLine->NbVertex(), aVertex);
// Change point in walking line.
aLocalWLine->SetPoint(aLocalWLine->NbPnts(), aVertex);
}
return aLocalWLine;
}
//=========================================================================
// function : IsInsideIn2d
// purpose : Check if aNextPnt lies inside of tube build on aBasePnt and aBaseVec.
// In 2d space. Static subfunction in DeleteByTube.
//=========================================================================
static Standard_Boolean IsInsideIn2d(const gp_Pnt2d& aBasePnt,
const gp_Vec2d& aBaseVec,
const gp_Pnt2d& aNextPnt,
const Standard_Real aSquareMaxDist)
{
gp_Vec2d aVec2d(aBasePnt, aNextPnt);
//d*d = (basevec^(nextpnt-basepnt))**2 / basevec**2
Standard_Real aCross = aVec2d.Crossed(aBaseVec);
Standard_Real aSquareDist = aCross * aCross
/ aBaseVec.SquareMagnitude();
return (aSquareDist <= aSquareMaxDist);
}
//=========================================================================
// function : IsInsideIn3d
// purpose : Check if aNextPnt lies inside of tube build on aBasePnt and aBaseVec.
// In 3d space. Static subfunction in DeleteByTube.
//=========================================================================
static Standard_Boolean IsInsideIn3d(const gp_Pnt& aBasePnt,
const gp_Vec& aBaseVec,
const gp_Pnt& aNextPnt,
const Standard_Real aSquareMaxDist)
{
gp_Vec aVec(aBasePnt, aNextPnt);
//d*d = (basevec^(nextpnt-basepnt))**2 / basevec**2
Standard_Real aSquareDist = aVec.CrossSquareMagnitude(aBaseVec)
/ aBaseVec.SquareMagnitude();
return (aSquareDist <= aSquareMaxDist);
}
static const Standard_Integer aMinNbBadDistr = 15;
static const Standard_Integer aNbSingleBezier = 30;
//=========================================================================
// function : DeleteByTube
// purpose : Check and delete points using tube criteria.
// Static subfunction in ComputePurgedWLine.
//=========================================================================
static Handle(IntPatch_WLine)
DeleteByTube(const Handle(IntPatch_WLine) &theWLine,
const Handle(Adaptor3d_HSurface) &theS1,
const Handle(Adaptor3d_HSurface) &theS2)
{
// III: Check points for tube criteria:
// Workaround to handle case of small amount points after purge.
// Test "boolean boptuc_complex B5" and similar.
Standard_Integer aNbPnt = 0 , i;
if (theWLine->NbPnts() <= 2)
return theWLine;
NCollection_Array1<Standard_Integer> aNewPointsHash(1, theWLine->NbPnts());
FillPointsHash(theWLine, aNewPointsHash);
// Inital computations.
Standard_Real UonS1[3], VonS1[3], UonS2[3], VonS2[3];
theWLine->Point(1).ParametersOnS1(UonS1[0], VonS1[0]);
theWLine->Point(2).ParametersOnS1(UonS1[1], VonS1[1]);
theWLine->Point(1).ParametersOnS2(UonS2[0], VonS2[0]);
theWLine->Point(2).ParametersOnS2(UonS2[1], VonS2[1]);
gp_Pnt2d aBase2dPnt1(UonS1[0], VonS1[0]);
gp_Pnt2d aBase2dPnt2(UonS2[0], VonS2[0]);
gp_Vec2d aBase2dVec1(UonS1[1] - UonS1[0], VonS1[1] - VonS1[0]);
gp_Vec2d aBase2dVec2(UonS2[1] - UonS2[0], VonS2[1] - VonS2[0]);
gp_Pnt aBase3dPnt = theWLine->Point(1).Value();
gp_Vec aBase3dVec(theWLine->Point(1).Value(), theWLine->Point(2).Value());
// Choose base tolerance and scale it to pipe algorithm.
const Standard_Real aBaseTolerance = Precision::Approximation();
Standard_Real aResS1Tol = Min(theS1->UResolution(aBaseTolerance),
theS1->VResolution(aBaseTolerance));
Standard_Real aResS2Tol = Min(theS2->UResolution(aBaseTolerance),
theS2->VResolution(aBaseTolerance));
Standard_Real aTol1 = aResS1Tol * aResS1Tol;
Standard_Real aTol2 = aResS2Tol * aResS2Tol;
Standard_Real aTol3d = aBaseTolerance * aBaseTolerance;
const Standard_Real aLimitCoeff = 0.99 * 0.99;
for(i = 3; i <= theWLine->NbPnts(); i++)
{
Standard_Boolean isDeleteState = Standard_False;
theWLine->Point(i).ParametersOnS1(UonS1[2], VonS1[2]);
theWLine->Point(i).ParametersOnS2(UonS2[2], VonS2[2]);
gp_Pnt2d aPnt2dOnS1(UonS1[2], VonS1[2]);
gp_Pnt2d aPnt2dOnS2(UonS2[2], VonS2[2]);
const gp_Pnt& aPnt3d = theWLine->Point(i).Value();
if (aNewPointsHash(i - 1) != - 1 &&
IsInsideIn2d(aBase2dPnt1, aBase2dVec1, aPnt2dOnS1, aTol1) &&
IsInsideIn2d(aBase2dPnt2, aBase2dVec2, aPnt2dOnS2, aTol2) &&
IsInsideIn3d(aBase3dPnt, aBase3dVec, aPnt3d, aTol3d) )
{
// Handle possible uneven parametrization on one of 2d subspaces.
// Delete point only when expected lengths are close to each other (aLimitCoeff).
// Example:
// c2d1 - line
// c3d - line
// c2d2 - geometrically line, but have uneven parametrization -> c2d2 is bspline.
gp_XY aPntOnS1[2]= { gp_XY(UonS1[1] - UonS1[0], VonS1[1] - VonS1[0])
, gp_XY(UonS1[2] - UonS1[1], VonS1[2] - VonS1[1])};
gp_XY aPntOnS2[2]= { gp_XY(UonS2[1] - UonS2[0], VonS2[1] - VonS2[0])
, gp_XY(UonS2[2] - UonS2[1], VonS2[2] - VonS2[1])};
Standard_Real aStepOnS1 = aPntOnS1[0].SquareModulus() / aPntOnS1[1].SquareModulus();
Standard_Real aStepOnS2 = aPntOnS2[0].SquareModulus() / aPntOnS2[1].SquareModulus();
// Check very rare case when wline fluctuates nearly one point and some of them may be equal.
// Middle point will be deleted when such situation occurs.
// bugs moddata_2 bug469.
if (Min(aStepOnS1, aStepOnS2) >= aLimitCoeff * Max(aStepOnS1, aStepOnS2))
{
// Set hash flag to "Delete" state.
isDeleteState = Standard_True;
aNewPointsHash.SetValue(i - 1, 1);
// Change middle point.
UonS1[1] = UonS1[2];
UonS2[1] = UonS2[2];
VonS1[1] = VonS1[2];
VonS2[1] = VonS2[2];
}
}
if (!isDeleteState)
{
// Compute new pipe parameters.
UonS1[0] = UonS1[1];
VonS1[0] = VonS1[1];
UonS2[0] = UonS2[1];
VonS2[0] = VonS2[1];
UonS1[1] = UonS1[2];
VonS1[1] = VonS1[2];
UonS2[1] = UonS2[2];
VonS2[1] = VonS2[2];
aBase2dPnt1.SetCoord(UonS1[0], VonS1[0]);
aBase2dPnt2.SetCoord(UonS2[0], VonS2[0]);
aBase2dVec1.SetCoord(UonS1[1] - UonS1[0], VonS1[1] - VonS1[0]);
aBase2dVec2.SetCoord(UonS2[1] - UonS2[0], VonS2[1] - VonS2[0]);
aBase3dPnt = theWLine->Point(i - 1).Value();
aBase3dVec = gp_Vec(theWLine->Point(i - 1).Value(), theWLine->Point(i).Value());
aNbPnt++;
}
}
// Workaround to handle case of small amount of points after purge.
// Test "boolean boptuc_complex B5" and similar.
// This is possible since there are at least two points.
if (aNewPointsHash(1) == -1 &&
aNewPointsHash(2) == -1 &&
aNbPnt <= 3)
{
// Delete first.
aNewPointsHash(1) = 1;
}
if (aNewPointsHash(theWLine->NbPnts() - 1) == -1 &&
aNewPointsHash(theWLine->NbPnts() ) == -1 &&
aNbPnt <= 3)
{
// Delete last.
aNewPointsHash(theWLine->NbPnts()) = 1;
}
// Purgre when too small amount of points left.
if (aNbPnt <= 2)
{
for(i = aNewPointsHash.Lower(); i <= aNewPointsHash.Upper(); i++)
{
if (aNewPointsHash(i) != -1)
{
aNewPointsHash(i) = 1;
}
}
}
// Handle possible bad distribution of points,
// which are will converted into one single bezier curve (less than 30 points).
// Make distribution more even:
// max step will be nearly to 0.1 of param distance.
if (aNbPnt + 2 > aMinNbBadDistr &&
aNbPnt + 2 < aNbSingleBezier )
{
for(Standard_Integer anIdx = 1; anIdx <= 8; anIdx++)
{
Standard_Integer aHashIdx =
Standard_Integer(anIdx * theWLine->NbPnts() / 9);
//Vertex must be stored as VERTEX (HASH = -1)
if (aNewPointsHash(aHashIdx) != -1)
aNewPointsHash(aHashIdx) = 0;
}
}
return MakeNewWLine(theWLine, aNewPointsHash);
}
//=======================================================================
//function : IsOnPeriod
//purpose : Checks, if [theU1, theU2] intersects the period-value
@@ -1285,137 +860,6 @@ static void ExtendTwoWLLastLast(const Handle(Adaptor3d_HSurface)& theS1,
theHasBeenJoined = Standard_True;
}
//=========================================================================
// function : ComputePurgedWLine
// purpose :
//=========================================================================
Handle(IntPatch_WLine) IntPatch_WLineTool::
ComputePurgedWLine(const Handle(IntPatch_WLine) &theWLine,
const Handle(Adaptor3d_HSurface) &theS1,
const Handle(Adaptor3d_HSurface) &theS2,
const Handle(Adaptor3d_TopolTool) &theDom1,
const Handle(Adaptor3d_TopolTool) &theDom2,
const Standard_Boolean theRestrictLine)
{
Standard_Integer i, k, v, nb, nbvtx;
Handle(IntPatch_WLine) aResult;
nbvtx = theWLine->NbVertex();
nb = theWLine->NbPnts();
if (nb==2)
{
const IntSurf_PntOn2S& p1 = theWLine->Point(1);
const IntSurf_PntOn2S& p2 = theWLine->Point(2);
if(p1.Value().IsEqual(p2.Value(), gp::Resolution()))
return aResult;
}
Handle(IntPatch_WLine) aLocalWLine;
Handle(IntPatch_WLine) aTmpWLine = theWLine;
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
for(i = 1; i <= nb; i++)
aLineOn2S->Add(theWLine->Point(i));
for(v = 1; v <= nbvtx; v++)
aLocalWLine->AddVertex(theWLine->Vertex(v));
// I: Delete equal points
for(i = 1; i <= aLineOn2S->NbPoints(); i++)
{
Standard_Integer aStartIndex = i + 1;
Standard_Integer anEndIndex = i + 5;
nb = aLineOn2S->NbPoints();
anEndIndex = (anEndIndex > nb) ? nb : anEndIndex;
if((aStartIndex > nb) || (anEndIndex <= 1))
continue;
k = aStartIndex;
while(k <= anEndIndex)
{
if(i != k)
{
IntSurf_PntOn2S p1 = aLineOn2S->Value(i);
IntSurf_PntOn2S p2 = aLineOn2S->Value(k);
Standard_Real UV[8];
p1.Parameters(UV[0], UV[1], UV[2], UV[3]);
p2.Parameters(UV[4], UV[5], UV[6], UV[7]);
Standard_Real aMax = Abs(UV[0]);
for(Standard_Integer anIdx = 1; anIdx < 8; anIdx++)
{
if (aMax < Abs(UV[anIdx]))
aMax = Abs(UV[anIdx]);
}
if(p1.Value().IsEqual(p2.Value(), gp::Resolution()) ||
Abs(UV[0] - UV[4]) + Abs(UV[1] - UV[5]) < 1.0e-16 * aMax ||
Abs(UV[2] - UV[6]) + Abs(UV[3] - UV[7]) < 1.0e-16 * aMax )
{
aTmpWLine = aLocalWLine;
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
for(v = 1; v <= aTmpWLine->NbVertex(); v++)
{
IntPatch_Point aVertex = aTmpWLine->Vertex(v);
Standard_Integer avertexindex = (Standard_Integer)aVertex.ParameterOnLine();
if(avertexindex >= k)
{
aVertex.SetParameter(aVertex.ParameterOnLine() - 1.);
}
aLocalWLine->AddVertex(aVertex);
}
aLineOn2S->RemovePoint(k);
anEndIndex--;
continue;
}
}
k++;
}
}
if (aLineOn2S->NbPoints() <= 2)
{
if (aLineOn2S->NbPoints() == 2)
return aLocalWLine;
else
return aResult;
}
// Avoid purge in case of C0 continuity:
// Intersection approximator may produce invalid curve after purge, example:
// bugs modalg_5 bug24731.
// Do not run purger when base number of points is too small.
if (theS1->UContinuity() == GeomAbs_C0 ||
theS1->VContinuity() == GeomAbs_C0 ||
theS2->UContinuity() == GeomAbs_C0 ||
theS2->VContinuity() == GeomAbs_C0 ||
nb < aNbSingleBezier)
{
return aLocalWLine;
}
if (theRestrictLine)
{
// II: Delete out of borders points.
aLocalWLine = DeleteOuterPoints(aLocalWLine, theS1, theS2, theDom1, theDom2);
}
// III: Delete points by tube criteria.
Handle(IntPatch_WLine) aLocalWLineTube =
DeleteByTube(aLocalWLine, theS1, theS2);
if(aLocalWLineTube->NbPnts() > 1)
{
aResult = aLocalWLineTube;
}
return aResult;
}
//=======================================================================
//function : JoinWLines
//purpose :

View File

@@ -27,29 +27,6 @@ public:
DEFINE_STANDARD_ALLOC
//! I
//! Removes equal points (leave one of equal points) from theWLine
//! and recompute vertex parameters.
//!
//! II
//! Removes point out of borders in case of non periodic surfaces.
//! This step is done only if theRestrictLine is true.
//!
//! III
//! Removes exceed points using tube criteria:
//! delete 7D point if it lies near to expected lines in 2d and 3d.
//! Each task (2d, 2d, 3d) have its own tolerance and checked separately.
//!
//! Returns new WLine or null WLine if the number
//! of the points is less than 2.
Standard_EXPORT static
Handle(IntPatch_WLine) ComputePurgedWLine(const Handle(IntPatch_WLine) &theWLine,
const Handle(Adaptor3d_HSurface) &theS1,
const Handle(Adaptor3d_HSurface) &theS2,
const Handle(Adaptor3d_TopolTool) &theDom1,
const Handle(Adaptor3d_TopolTool) &theDom2,
const Standard_Boolean theRestrictLine);
//! Joins all WLines from theSlin to one if it is possible and records
//! the result into theSlin again. Lines will be kept to be splitted if:
//! a) they are separated (has no common points);

View File

@@ -521,7 +521,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
}
else if ((aType2==GeomAbs_Plane) && isFace1Quad)
{
Standard_Real umin, umax, vmin, vmax;
@@ -533,7 +533,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
}
else
{
Standard_Real umin, umax, vmin, vmax;
@@ -553,12 +553,8 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
Tolerances(myHS1, myHS2, TolTang);
{
const Standard_Real UVMaxStep = 0.001;
const Standard_Real Deflection = 0.1;
myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection);
}
myIntersector.SetTolerances(TolArc, TolTang, 0.1);
if((myHS1->IsUClosed() && !myHS1->IsUPeriodic()) ||
(myHS1->IsVClosed() && !myHS1->IsVPeriodic()) ||
(myHS2->IsUClosed() && !myHS2->IsUPeriodic()) ||

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,7 @@ public:
//! border of one of the domains. If an open line
//! stops at the middle of a domain, one stops at the tangent point.
//! Epsilon is SquareTolerance of points confusion.
Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection);
//! Returns the intersection line containing the exact
//! point Poin. This line is a polygonal line.
@@ -81,7 +81,7 @@ public:
//! border of one of the domains. If an open line
//! stops at the middle of a domain, one stops at the tangent point.
//! Epsilon is SquareTolerance of points confusion.
Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
//! calculate the line of intersection
Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep);
@@ -126,32 +126,40 @@ public:
const gp_Dir& TangentAtLine (Standard_Integer& Index) const;
Standard_EXPORT IntWalk_StatusDeflection TestDeflection (const IntImp_ConstIsoparametric ChoixIso) ;
Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti, TColStd_Array1OfReal& Param, IntImp_ConstIsoparametric& ChoixIso);
Standard_EXPORT void RepartirOuDiviser (Standard_Boolean& DejaReparti, IntImp_ConstIsoparametric& ChoixIso, Standard_Boolean& Arrive);
void AddAPoint (Handle(IntSurf_LineOn2S)& line, const IntSurf_PntOn2S& POn2S);
void AddAPoint (Handle(IntSurf_LineOn2S)& line, const IntSurf_PntOn2S& POn2S);
Standard_EXPORT Standard_Boolean PutToBoundary (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2);
Standard_EXPORT Standard_Boolean SeekAdditionalPoints (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Integer theMinNbPoints);
Standard_Real MaxStep(Standard_Integer theIndex)
Standard_Real Step(Standard_Integer theIndex) const
{
Standard_OutOfRange_Raise_if((theIndex < 0) || (theIndex > 3), "");
return pasInit[theIndex];
return myRelMaxStep*pasInit[theIndex];
}
Standard_Real MaxStep(void) const
{
Standard_Real aRetVal = pasInit[0];
for(Standard_Integer i = 1; i < 4; i++)
aRetVal = Max(aRetVal, pasInit[i]);
return myRelMaxStep*aRetVal;
}
protected:
IntWalk_PWalking operator=(const IntWalk_PWalking&);
Standard_EXPORT void ComputePasInit(const Standard_Real theDeltaU1,
const Standard_Real theDeltaV1,
const Standard_Real theDeltaU2,
const Standard_Real theDeltaV2);
Standard_EXPORT IntWalk_StatusDeflection TestDeflection (const IntImp_ConstIsoparametric ChoixIso) ;
Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti, TColStd_Array1OfReal& Param, IntImp_ConstIsoparametric& ChoixIso);
//! Uses Gradient method in order to find intersection point between the given surfaces
//! Arrays theInit (initial point to be precise) and theStep0 (steps-array) must contain
//! four items and must be filled strictly in following order:
@@ -161,6 +169,7 @@ protected:
TColStd_Array1OfReal& theInit,
const Standard_Real* theStep0 = 0);
//! Finds the point on theASurf which is the nearest point to theP0.
//! theU0 and theV0 must be initialized (before calling the method) by initial
//! parameters on theASurf. Their values are changed while algorithm being launched.
@@ -172,6 +181,7 @@ protected:
Standard_Real& theV0,
const Standard_Real* theStep0 = 0);
//! Searches an intersection point which lies on the some surface boundary.
//! Found point (in case of successful result) is added in the line.
//! theU1, theV1, theU2 and theV2 parameters are initial parameters in
@@ -191,6 +201,8 @@ protected:
const Standard_Real theV2,
const Standard_Boolean isTheFirst);
Standard_EXPORT IntWalk_StatusDeflection IntersPerform(const Standard_Boolean theIsForceAdd, IntImp_ConstIsoparametric& theInitIsoChoosen, math_FunctionSetRoot& theRSFunc, Standard_Real theDeltaParam[4]);
Standard_EXPORT void ContinueInAnotherDirection(IntImp_ConstIsoparametric& ChoixIso);
// Method to handle single singular point. Sub-method in SeekPointOnBoundary.
Standard_EXPORT Standard_Boolean HandleSingleSingularPoint(const Handle(Adaptor3d_HSurface) &theASurf1,
@@ -198,10 +210,12 @@ protected:
const Standard_Real the3DTol,
TColStd_Array1OfReal &thePnt);
Standard_EXPORT Standard_Boolean ExtendLineInCommonZone (const IntImp_ConstIsoparametric theChoixIso,
const Standard_Boolean theDirectionFlag);
private:
Standard_Boolean done;
Handle(IntSurf_LineOn2S) line;
Standard_Boolean close;
@@ -210,25 +224,18 @@ private:
Standard_Integer indextg;
gp_Dir tgdir;
Standard_Real fleche;
Standard_Real pasMax;
Standard_Real tolconf;
Standard_Real myTolTang;
Standard_Real pasuv[4];
const Standard_Real myRelMaxStep;
const Standard_Real myIncMultiplier;
const Standard_Real myDecMultiplier;
Standard_Real myStepMin[4];
Standard_Real pasSav[4];
Standard_Real pasInit[4];
Standard_Real Um1;
Standard_Real UM1;
Standard_Real Vm1;
Standard_Real VM1;
Standard_Real Um2;
Standard_Real UM2;
Standard_Real Vm2;
Standard_Real VM2;
Standard_Real ResoU1;
Standard_Real ResoU2;
Standard_Real ResoV1;
Standard_Real ResoV2;
Standard_Real pasInit[4]; // Should be constant while algorithm working
Standard_Real myMaxParam[4]; //[0] = UM1, [1] = VM1, [2] = UM2, [3] = VM2
Standard_Real myMinParam[4]; //[0] = Um1, [1] = Vm1, [2] = Um2, [3] = Vm2
Standard_Real myReso[4]; //[0] = ResoU1, [1] = ResoV1, [2] = ResoU2, [3] = ResoV2
Standard_Integer sensCheminement;
IntImp_ConstIsoparametric choixIsoSav;
IntSurf_PntOn2S previousPoint;
@@ -239,10 +246,6 @@ private:
gp_Dir2d firstd1;
gp_Dir2d firstd2;
IntWalk_TheInt2S myIntersectionOn2S;
Standard_Integer STATIC_BLOCAGE_SUR_PAS_TROP_GRAND;
Standard_Integer STATIC_PRECEDENT_INFLEXION;
};

View File

@@ -25,6 +25,12 @@ IntWalk_StepTooSmall,
IntWalk_PointConfondu,
IntWalk_ArretSurPointPrecedent,
IntWalk_ArretSurPoint,
IntWalk_IntersectsBoundary,
IntWalk_IntersectPointNotFound,
IntWalk_TooManyPoints,
IntWalk_AnotherDirection,
IntWalk_DirectionNotFound,
IntWalk_ForcefulAdding,
IntWalk_OK
};

View File

@@ -195,8 +195,9 @@ void TopOpeBRep_FacesIntersector::Perform(const TopoDS_Shape& F1,const TopoDS_Sh
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFF.Start();
#endif
Standard_Real Deflection=0.01,MaxUV=0.01;
Standard_Real Deflection=0.01;
if (!myForceTolerances) {
Standard_Real MaxUV;
FTOL_FaceTolerances3d(B1,B2,myFace1,myFace2,S1,S2,
myTol1,myTol2,Deflection,MaxUV);
myTol1 = (myTol1 > 1.e-4)? 1.e-4: myTol1;
@@ -211,14 +212,12 @@ void TopOpeBRep_FacesIntersector::Perform(const TopoDS_Shape& F1,const TopoDS_Sh
if (TopOpeBRep_GettraceFITOL()) {
cout<<"FacesIntersector : Perform tol1 = "<<tol1<<endl;
cout<<" tol2 = "<<tol2<<endl;
cout<<" defl = "<<Deflection<<" MaxUV = "<<MaxUV<<endl;
}
#endif
myIntersector.SetTolerances(myTol1,myTol2,MaxUV,Deflection);
myIntersector.SetTolerances(myTol1,myTol2,Deflection);
myIntersector.Perform(mySurface1,myDomain1,mySurface2,myDomain2,
myTol1,myTol2,Standard_True,Standard_True,
Standard_False);
myTol1,myTol2,Standard_True,Standard_True);
#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFF.Stop();

View File

@@ -1,3 +1,5 @@
puts "TODO OCCT ALL: Faulty shapes in variables faulty_1 to faulty_4"
# Original bug : fra60810
# Date : 30mar98
@@ -7,3 +9,23 @@ restore [locate_data_file CTO900_fra60810-tool.rle] tool
bcut result part tool
checkprops result -s 30948.9
checkview -display result -2d -s -otherwise { part tool } -path ${imagedir}/${test_image}.png
############
# This fragment should be deleted later.
# It is used for regression explanation. Intersection result seems to be valid.
restore [locate_data_file CTO900_fra60810-part.rle] part
restore [locate_data_file CTO900_fra60810-tool.rle] tool
explode part f
explode tool f
donly part_9 part_10 part_23 part_24 tool_4 tool_13
bclearobjects
bcleartools
baddobjects part_9 part_10 part_23 part_24
baddtools tool_4 tool_13
bfillds
bbop rr 4

View File

@@ -4,5 +4,11 @@ explode m
compound m_2 m_3 m_4 m_5 c1
bcut result m_1 c1
set log [bopargcheck result #F]
if { [string compare -nocase $log "Shape(s) seem(s) to be valid for BOP.\n"] } {
puts "ERROR. result is not valid for BOP"
}
checkprops result -s 57618.4
checkview -display result -2d -s -otherwise { m_1 c1 } -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,41 @@
puts "========"
puts "OCC23914"
puts "========"
puts ""
#################################
# Intersection algorithm produced too many intersection points
#################################
set max_time 0.05
bsplinesurf s1 1 2 0 2 1000 2 1 2 200 2 2000 2 100 300 200 1 400 300 200 1 100 300 500 1 400 300 500 1
bsplinesurf s2 1 2 0 2 100 2 1 2 500 2 1000 2 100 200 400 1 500 200 400 1 100 600 400 1 500 600 400 1
dchrono cr reset
dchrono cr start
intersect result s1 s2 -npp
# Only one curve must be found
dchrono cr stop
set chrono_info [dchrono cr show]
regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
if { $CPU_time > ${max_time} } {
puts "CPU user time of Boolean operation is more than ${max_time} seconds - Error"
} else {
puts "CPU user time of Boolean operation is less than ${max_time} seconds - OK"
}
mkedge ee result
checkprops ee -l 300
bounds result t1 t2
xdistcs result s1 t1 t2 10 1.0e-7
xdistcs result s2 t1 t2 10 1.0e-7
smallview
donly s1 s2 result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -12,7 +12,7 @@ set U2 0.01131870392278708
set V1 226.9760100729095
set V2 203.7283534809051
intersect result su1 su2 $U1 $V1 $U2 $V2
intersect result su1 su2 -sp $U1 $V1 $U2 $V2
set che [whatis result]