1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0024005: Intersecting a slightly off angle plane with a cylinder takes 7+ seconds

Checking of possibility of bad result.
Adding test case for issue CR24005
Correction of test case for issue CR24005
This commit is contained in:
nbv 2013-09-19 16:46:17 +04:00 committed by bugmaster
parent bb58e462ad
commit 788cbaf4c4
11 changed files with 1406 additions and 1060 deletions

View File

@ -3068,7 +3068,17 @@ Standard_Boolean ChFi3d_ComputeCurves(Handle(Adaptor3d_HSurface)& S1,
cyl = S1->Cylinder(); cyl = S1->Cylinder();
} }
IntAna_QuadQuadGeo ImpKK(pl,cyl,Precision::Angular(),tol3d); IntAna_QuadQuadGeo ImpKK(pl,cyl,Precision::Angular(),tol3d);
if (ImpKK.IsDone()) { Standard_Boolean isIntDone = ImpKK.IsDone();
if(ImpKK.TypeInter() == IntAna_Ellipse)
{
const gp_Elips anEl = ImpKK.Ellipse(1);
const Standard_Real aMajorR = anEl.MajorRadius();
const Standard_Real aMinorR = anEl.MinorRadius();
isIntDone = (aMajorR < 100000.0 * aMinorR);
}
if (isIntDone) {
Standard_Boolean c1line = 0; Standard_Boolean c1line = 0;
switch (ImpKK.TypeInter()) { switch (ImpKK.TypeInter()) {
case IntAna_Line: case IntAna_Line:

View File

@ -1627,10 +1627,21 @@ Handle(Geom_Surface) Draft_Modification::NewSurface
#endif #endif
return NewS; return NewS;
} }
if (Abs(Angle) > Precision::Angular()) { if (Abs(Angle) > Precision::Angular())
{
IntAna_QuadQuadGeo i2s; IntAna_QuadQuadGeo i2s;
i2s.Perform(NeutralPlane,Cy,Precision::Angular(),Precision::Confusion()); i2s.Perform(NeutralPlane,Cy,Precision::Angular(),Precision::Confusion());
if (!i2s.IsDone() || i2s.TypeInter() != IntAna_Circle) { Standard_Boolean isIntDone = i2s.IsDone();
if(i2s.TypeInter() == IntAna_Ellipse)
{
const gp_Elips anEl = i2s.Ellipse(1);
const Standard_Real aMajorR = anEl.MajorRadius();
const Standard_Real aMinorR = anEl.MinorRadius();
isIntDone = (aMajorR < 100000.0 * aMinorR);
}
if (!isIntDone || i2s.TypeInter() != IntAna_Circle) {
#ifdef DEB #ifdef DEB
cout << "NewSurfaceCyl:Draft_Intersection_Neutral_Cylinder_NotDone" << endl; cout << "NewSurfaceCyl:Draft_Intersection_Neutral_Cylinder_NotDone" << endl;
#endif #endif

View File

@ -534,13 +534,7 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
param1bis = radius; param1bis = radius;
} }
} }
if(typeres == IntAna_Ellipse) {
if( param1>100000.0*param1bis
|| param1bis>100000.0*param1) {
done = Standard_False;
return;
}
}
done = Standard_True; done = Standard_True;
} }
//======================================================================= //=======================================================================

View File

@ -550,185 +550,289 @@ void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
SortAgain = Standard_False; SortAgain = Standard_False;
SortIsOK = Standard_True; SortIsOK = Standard_True;
for(i=2; i<=nbvtx && SortIsOK; i++) { for(i=2; i<=nbvtx && SortIsOK; i++)
{
IntPatch_Point& VTX = svtx.ChangeValue(i); IntPatch_Point& VTX = svtx.ChangeValue(i);
for(j=1; j<=nbvtx && SortIsOK; j++) { for(j=1; j<=nbvtx && SortIsOK; j++)
if(i!=j) { {
IntPatch_Point& VTXM1 = svtx.ChangeValue(j); if(i!=j)
Standard_Boolean kill = Standard_False; {
Standard_Boolean killm1 = Standard_False; IntPatch_Point& VTXM1 = svtx.ChangeValue(j);
if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PrecisionPConfusion) { Standard_Boolean kill = Standard_False;
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1 Standard_Boolean killm1 = Standard_False;
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1 if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PrecisionPConfusion)
if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2 {
if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2 if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) //-- OnS1 OnS1
kill=Standard_True; {
} if(VTXM1.ArcOnS1() == VTX.ArcOnS1())//-- OnS1 == OnS1
else { {
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2 if(VTXM1.IsOnDomS2()) //-- OnS1 == OnS1 OnS2
if(VTXM1.IsVertexOnS2()) { {
kill=Standard_True; if(VTX.IsOnDomS2()==Standard_False)//-- OnS1 == OnS1 OnS2 PasOnS2
} {
else { kill=Standard_True;
killm1=Standard_True; }
} else
} {
} if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) //-- OnS1 == OnS1 OnS2 == OnS2
} {
else { //-- OnS1 == OnS1 PasOnS2 if(VTXM1.IsVertexOnS2())
if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2 {
killm1=Standard_True; kill=Standard_True;
} }
} else
} {
} killm1=Standard_True;
else { //-- Pas OnS1 et OnS1 }
if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False) { }
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) { }
kill=Standard_True; }
} else //-- OnS1 == OnS1 PasOnS2
else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False) { {
killm1=Standard_True; if(VTX.IsOnDomS2()) //-- OnS1 == OnS1 PasOnS2 OnS2
} {
} killm1=Standard_True;
} }
}
}
}
else //-- Pas OnS1 et OnS1
{
if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False)
{
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False)
{
kill=Standard_True;
}
else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False)
{
killm1=Standard_True;
}
}
}
if(!(kill || killm1)) { if(!(kill || killm1))
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2 {
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2 if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) //-- OnS2 OnS2
if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1 {
if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1 if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) //-- OnS2 == OnS2
kill=Standard_True; {
} if(VTXM1.IsOnDomS1()) //-- OnS2 == OnS2 OnS1
else { {
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1 if(VTX.IsOnDomS1()==Standard_False) //-- OnS2 == OnS2 OnS1 PasOnS1
if(VTXM1.IsVertexOnS1()) { {
kill=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 Vtx PasVtx kill=Standard_True;
} }
else { else
killm1=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 PasVtx Vtx {
} if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) //-- OnS2 == OnS2 OnS1 == OnS1
} {
} if(VTXM1.IsVertexOnS1())
} {
else { //-- OnS2 == OnS2 PasOnS1 kill=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 Vtx PasVtx
if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1 }
killm1=Standard_True; else
} {
} killm1=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 PasVtx Vtx
} }
} }
else { //-- Pas OnS2 et OnS2 }
if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False) { }
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) { else
kill=Standard_True; { //-- OnS2 == OnS2 PasOnS1
} if(VTX.IsOnDomS1()) //-- OnS2 == OnS2 PasOnS1 OnS1
else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False) { {
killm1=Standard_True; killm1=Standard_True;
} }
} }
} }
} }
//-- On a j < i else //-- Pas OnS2 et OnS2
if(kill) { {
SortIsOK = Standard_False; if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False)
if(lapt) { if(indl>i) indl--; else if(indl==i) indl=j; } {
if(fipt) { if(indf>i) indf--; else if(indf==i) indf=j; } if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False)
svtx.Remove(i); {
nbvtx--; kill=Standard_True;
} }
else if(killm1) { else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False)
SortIsOK = Standard_False; {
if(lapt) { if(indl>j) indl--; else if(indl==j) indl=i-1;} killm1=Standard_True;
if(fipt) { if(indf>j) indf--; else if(indf==j) indf=i-1;} }
svtx.Remove(j); }
nbvtx--; }
} }
// else
else if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) { // eap
//-- deux points de meme parametre qui ne peuvent etre confondus
//-- On change les parametres d un des points si les points UV sont
//-- differents. Ceci distingue le cas des aretes de couture.
// ==========================================================
//-- 2 points with the same parameters
//-- Change parametres of one point if points UV are
//-- different. This is the case of seam edge
Standard_Real ponline = VTX.ParameterOnLine();
// eap, =>>
Standard_Real newParam = ponline;
const Standard_Real PiPi = M_PI+M_PI;
Standard_Boolean is2PI = ( Abs(ponline-PiPi) <= PrecisionPConfusion );
if (nbvtx > 2 && // do this check if seam edge only gives vertices //-- On a j < i
!is2PI) // but always change 2PI -> 0 if(kill)
continue; {
SortIsOK = Standard_False;
if(lapt)
{
if(indl>i)
indl--;
else if(indl==i)
indl=j;
}
if (is2PI) if(fipt)
newParam = 0; {
else if (Abs(ponline) <= PrecisionPConfusion) if(indf>i)
newParam = PiPi; indf--;
else else if(indf==i)
newParam -= PiPi; indf=j;
// if( (Abs(ponline)<=PrecisionPConfusion) }
// ||(Abs(ponline-M_PI-M_PI) <=PrecisionPConfusion))
// eap, <<=
Standard_Real u1a,v1a,u2a,v2a,u1b,v1b,u2b,v2b;
VTXM1.Parameters(u1a,v1a,u2a,v2a);
VTX.Parameters(u1b,v1b,u2b,v2b);
Standard_Integer flag = 0;
if( (Abs(u1a-u1b)<=PrecisionPConfusion) ) flag|=1; svtx.Remove(i);
if( (Abs(v1a-v1b)<=PrecisionPConfusion) ) flag|=2; nbvtx--;
if( (Abs(u2a-u2b)<=PrecisionPConfusion) ) flag|=4; }
if( (Abs(v2a-v2b)<=PrecisionPConfusion) ) flag|=8; else if(killm1)
Standard_Boolean TestOn1 = Standard_False; {
Standard_Boolean TestOn2 = Standard_False; SortIsOK = Standard_False;
switch(flag) { if(lapt)
case 3: //-- meme point U1 V1 {
case 7: //-- meme point U1 V1 meme U2 if(indl>j)
case 12: //-- meme U2 V2 indl--;
case 13: //-- meme point U1 meme U2 V2 else if(indl==j)
case 10: //-- meme point V1 meme V2 Test si U1a=U1b Mod 2PI et Test si U2a=U2b Mod 2PI indl=i-1;
break; }
case 11: //-- meme point U1 V1 meme V2 Test si U2a=U2b Mod 2PI
{ TestOn2 = Standard_True; break; } if(fipt)
case 14: //-- meme point V1 meme U2 V2 Test si U1a=U1b Mod 2PI {
{ TestOn1 = Standard_True; break; } if(indf>j)
default: break; indf--;
}; else if(indf==j)
// eap indf=i-1;
//if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) {} }
if(TestOn1) {
//// modified by jgv, 2.11.01 for BUC61033 //// svtx.Remove(j);
Standard_Real U1A = (u1a < u1b)? u1a : u1b; nbvtx--;
Standard_Real U1B = (u1a < u1b)? u1b : u1a; }// else
if (u1min == RealLast()) else if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) // eap
{ {
u1min = U1A; //-- deux points de meme parametre qui ne peuvent etre confondus
u1max = U1B; //-- On change les parametres d un des points si les points UV sont
} //-- differents. Ceci distingue le cas des aretes de couture.
else // ==========================================================
{ //-- 2 points with the same parameters
if (Abs(U1A-u1min) > PrecisionPConfusion) //-- Change parametres of one point if points UV are
ToBreak = Standard_True; //-- different. This is the case of seam edge
if (Abs(U1B-u1max) > PrecisionPConfusion)
ToBreak = Standard_True; Standard_Real ponline = VTX.ParameterOnLine();
} // eap, =>>
Standard_Real newParam = ponline;
const Standard_Real PiPi = M_PI+M_PI;
Standard_Boolean is2PI = ( Abs(ponline-PiPi) <= PrecisionPConfusion );
if (nbvtx > 2 && // do this check if seam edge only gives vertices
!is2PI) // but always change 2PI -> 0
continue;
if (is2PI)
newParam = 0;
else if (Abs(ponline) <= PrecisionPConfusion)
newParam = PiPi;
else
newParam -= PiPi;
// if( (Abs(ponline)<=PrecisionPConfusion)
// ||(Abs(ponline-M_PI-M_PI) <=PrecisionPConfusion))
// eap, <<=
Standard_Real u1a,v1a,u2a,v2a,u1b,v1b,u2b,v2b;
VTXM1.Parameters(u1a,v1a,u2a,v2a);
VTX.Parameters(u1b,v1b,u2b,v2b);
Standard_Integer flag = 0;
if( (Abs(u1a-u1b)<=PrecisionPConfusion) )
flag|=1;
if( (Abs(v1a-v1b)<=PrecisionPConfusion) )
flag|=2;
if( (Abs(u2a-u2b)<=PrecisionPConfusion) )
flag|=4;
if( (Abs(v2a-v2b)<=PrecisionPConfusion) )
flag|=8;
Standard_Boolean TestOn1 = Standard_False;
Standard_Boolean TestOn2 = Standard_False;
switch(flag)
{
case 3: //-- meme point U1 V1
case 7: //-- meme point U1 V1 meme U2
case 12: //-- meme U2 V2
case 13: //-- meme point U1 meme U2 V2
case 10: //-- meme point V1 meme V2 Test si U1a=U1b Mod 2PI et Test si U2a=U2b Mod 2PI
break;
case 11: //-- meme point U1 V1 meme V2 Test si U2a=U2b Mod 2PI
{
TestOn2 = Standard_True;
break;
}
case 14: //-- meme point V1 meme U2 V2 Test si U1a=U1b Mod 2PI
{
TestOn1 = Standard_True;
break;
}
default:
break;
};
// eap
//if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) {}
if(TestOn1)
{
//// modified by jgv, 2.11.01 for BUC61033 ////
Standard_Real U1A = (u1a < u1b)? u1a : u1b;
Standard_Real U1B = (u1a < u1b)? u1b : u1a;
if (u1min == RealLast())
{
u1min = U1A;
u1max = U1B;
}
else
{
if (Abs(U1A-u1min) > PrecisionPConfusion)
ToBreak = Standard_True;
if (Abs(U1B-u1max) > PrecisionPConfusion)
ToBreak = Standard_True;
}
/////////////////////////////////////////////// ///////////////////////////////////////////////
// eap, =>> // eap, =>>
// if (Abs(ponline) <= PrecisionPConfusion) { // if (Abs(ponline) <= PrecisionPConfusion) {
// const Standard_Real PiPi = M_PI+M_PI; // const Standard_Real PiPi = M_PI+M_PI;
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) { /*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/)
SortAgain = Standard_True; {
SortIsOK = Standard_False; SortAgain = Standard_True;
if (newParam > ponline) SortIsOK = Standard_False;
if(u1a < u1b) { VTX.SetParameter(newParam); } if (newParam > ponline)
else { VTXM1.SetParameter(newParam); } {
else if(u1a < u1b)
if(u1a > u1b) { VTX.SetParameter(newParam); } {
else { VTXM1.SetParameter(newParam); } VTX.SetParameter(newParam);
} }
else
{
VTXM1.SetParameter(newParam);
}
}
else
{
if(u1a > u1b)
{
VTX.SetParameter(newParam);
}
else
{
VTXM1.SetParameter(newParam);
}
}
}
// } // }
// else { // else {
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) { // if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
@ -739,38 +843,59 @@ void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
// } // }
// } // }
// eap, <<= // eap, <<=
} }
if(TestOn2) {
//// modified by jgv, 2.11.01 for BUC61033 //// if(TestOn2)
Standard_Real U2A = (u2a < u2b)? u2a : u2b; {
Standard_Real U2B = (u2a < u2b)? u2b : u2a; //// modified by jgv, 2.11.01 for BUC61033 ////
if (u2min == RealLast()) Standard_Real U2A = (u2a < u2b)? u2a : u2b;
{ Standard_Real U2B = (u2a < u2b)? u2b : u2a;
u2min = U2A; if (u2min == RealLast())
u2max = U2B; {
} u2min = U2A;
else u2max = U2B;
{ }
if (Abs(U2A-u2min) > PrecisionPConfusion) else
ToBreak = Standard_True; {
if (Abs(U2B-u2max) > PrecisionPConfusion) if (Abs(U2A-u2min) > PrecisionPConfusion)
ToBreak = Standard_True; ToBreak = Standard_True;
}
if (Abs(U2B-u2max) > PrecisionPConfusion)
ToBreak = Standard_True;
}
/////////////////////////////////////////////// ///////////////////////////////////////////////
// eap, =>> // eap, =>>
// if (Abs(ponline) <= PrecisionPConfusion) { // if (Abs(ponline) <= PrecisionPConfusion) {
// const Standard_Real PiPi = M_PI+M_PI; // const Standard_Real PiPi = M_PI+M_PI;
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) { /*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/)
SortAgain = Standard_True; {
SortIsOK = Standard_False; SortAgain = Standard_True;
if (newParam > ponline) SortIsOK = Standard_False;
if(u2a < u2b) { VTX.SetParameter(newParam); } if (newParam > ponline)
else { VTXM1.SetParameter(newParam); } {
else if(u2a < u2b)
if(u2a > u2b) { VTX.SetParameter(newParam); } {
else { VTXM1.SetParameter(newParam); } VTX.SetParameter(newParam);
} }
else
{
VTXM1.SetParameter(newParam);
}
}
else
{
if(u2a > u2b)
{
VTX.SetParameter(newParam);
}
else
{
VTXM1.SetParameter(newParam);
}
}
}
// } // }
// else { // else {
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) { // if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
@ -783,10 +908,10 @@ void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
// } // }
// } // }
// eap, <<= // eap, <<=
} }
} }
} }
} }
} //-- if(i!=j) } //-- if(i!=j)
} }
} }
@ -809,6 +934,7 @@ void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
} }
} }
while(!SortIsOK); while(!SortIsOK);
indl=nbvtx; indl=nbvtx;
indf=1; indf=1;
} }

View File

@ -76,7 +76,7 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
IntSurf_Quadric quad1; IntSurf_Quadric quad1;
IntSurf_Quadric quad2; IntSurf_Quadric quad2;
IntPatch_ArcFunction AFunc; IntPatch_ArcFunction AFunc;
Standard_Real Tolang = 1.e-8; const Standard_Real Tolang = 1.e-8;
GeomAbs_SurfaceType typs1 = S1->GetType(); GeomAbs_SurfaceType typs1 = S1->GetType();
GeomAbs_SurfaceType typs2 = S2->GetType(); GeomAbs_SurfaceType typs2 = S2->GetType();
// //

View File

@ -22,20 +22,20 @@
class Intersection from IntPatch class Intersection from IntPatch
---Purpose: This class provides a generic algorithm to intersect ---Purpose: This class provides a generic algorithm to intersect
-- 2 surfaces. -- 2 surfaces.
uses uses
HVertex from Adaptor3d, HVertex from Adaptor3d,
HCurve2d from Adaptor2d, HCurve2d from Adaptor2d,
HSurface from Adaptor3d, HSurface from Adaptor3d,
Point from IntPatch, Point from IntPatch,
SequenceOfPoint from IntPatch, SequenceOfPoint from IntPatch,
TopolTool from Adaptor3d, TopolTool from Adaptor3d,
SequenceOfLine from IntPatch, SequenceOfLine from IntPatch,
Line from IntPatch, Line from IntPatch,
--amv SurfaceType from GeomAbs,
ListOfPntOn2S from IntSurf ListOfPntOn2S from IntSurf
raises NotDone from StdFail, raises NotDone from StdFail,
OutOfRange from Standard, OutOfRange from Standard,
@ -52,147 +52,160 @@ is
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d; S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard) TolArc,TolTang: Real from Standard)
returns Intersection from IntPatch returns Intersection from IntPatch
raises ConstructionError from Standard;
raises ConstructionError from Standard;
Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d; Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard) TolArc,TolTang: Real from Standard)
returns Intersection from IntPatch returns Intersection from IntPatch
raises ConstructionError from Standard;
raises ConstructionError from Standard;
SetTolerances(me : in out; SetTolerances(me : in out;
TolArc : Real from Standard; TolArc : Real from Standard;
TolTang : Real from Standard; TolTang : Real from Standard;
UVMaxStep: Real from Standard; UVMaxStep: Real from Standard;
Fleche : Real from Standard) Fleche : Real from Standard)
---Purpose: Set the tolerances used by the algorithms: ---Purpose: Set the tolerances used by the algorithms:
-- --- Implicit - Parametric -- --- Implicit - Parametric
-- --- Parametric - Parametric -- --- Parametric - Parametric
-- --- Implicit - Implicit -- --- Implicit - Implicit
-- --
-- TolArc is used to compute the intersections -- TolArc is used to compute the intersections
-- between the restrictions of a surface and a -- between the restrictions of a surface and a
-- walking line. -- walking line.
-- --
-- TolTang is used to compute the points on a walking -- TolTang is used to compute the points on a walking
-- line, and in geometric algorithms. -- line, and in geometric algorithms.
-- --
-- Fleche is a parameter used in the walking -- Fleche is a parameter used in the walking
-- algorithms to provide small curvatures on a line. -- algorithms to provide small curvatures on a line.
-- --
-- UVMaxStep is a parameter used in the walking -- UVMaxStep is a parameter used in the walking
-- algorithms to compute the distance between to -- algorithms to compute the distance between to
-- points in their respective parametrtic spaces. -- points in their respective parametrtic spaces.
-- --
is static;
Perform (me: in out; is static;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard)
raises ConstructionError from Standard
is static;
--amv
Perform (me: in out; Perform (me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d; S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d; S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard; TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf; isGeomInt : Boolean from Standard = Standard_True)
RestrictLine: Boolean from Standard = Standard_True)
raises ConstructionError from Standard raises ConstructionError from Standard
is static;
is static; --amv
Perform ( me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf;
RestrictLine: Boolean from Standard = Standard_True;
isGeomInt : Boolean from Standard = Standard_True)
Perform (me: in out; ---Purpose: If isGeomInt == Standard_False, then method
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d; -- Param-Param intersection will be used.
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
U1,V1,U2,V2 : Real from Standard;
TolArc,TolTang: Real from Standard)
raises ConstructionError from Standard raises ConstructionError from Standard
is static;
is static; Perform ( me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
U1,V1,U2,V2 : Real from Standard;
TolArc,TolTang: Real from Standard)
raises ConstructionError from Standard
is static;
Perform (me: in out; Perform (me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d; S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard) TolArc,TolTang: Real from Standard)
raises ConstructionError from Standard raises ConstructionError from Standard
is static;
is static; ParamParamPerfom( me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf;
RestrictLine: Boolean from Standard;
typs1, typs2: SurfaceType from GeomAbs)
is private;
GeomGeomPerfom( me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf;
RestrictLine: Boolean from Standard;
typs1, typs2: SurfaceType from GeomAbs)
is private;
GeomParamPerfom(me: in out;
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
isNotAnalitical: Boolean from Standard;
typs1, typs2: SurfaceType from GeomAbs)
is private;
IsDone(me) IsDone(me)
---Purpose: Returns True if the calculus was succesfull. ---Purpose: Returns True if the calculus was succesfull.
returns Boolean from Standard returns Boolean from Standard
---C++: inline ---C++: inline
is static; is static;
IsEmpty(me) IsEmpty(me)
---Purpose: Returns true if the is no intersection.
---Purpose: Returns true if the is no intersection. ---C++: inline
returns Boolean from Standard
returns Boolean from Standard raises NotDone from StdFail
---C++: inline is static;
raises NotDone from StdFail
is static;
TangentFaces(me) TangentFaces(me)
---Purpose: Returns True if the two patches are considered as
-- entierly tangent, i-e every restriction arc of one
-- patch is inside the geometric base of the other patch.
---C++: inline
---Purpose: Returns True if the two patches are considered as returns Boolean from Standard
-- entierly tangent, i-e every restriction arc of one raises NotDone from StdFail
-- patch is inside the geometric base of the other patch. is static;
returns Boolean from Standard
---C++: inline
raises NotDone from StdFail
is static;
OppositeFaces(me) OppositeFaces(me)
---Purpose: Returns True when the TangentFaces returns True and the
---Purpose: Returns True when the TangentFaces returns True and the -- normal vectors evaluated at a point on the first and the
-- normal vectors evaluated at a point on the first and the -- second surface are opposite.
-- second surface are opposite. -- The exception DomainError is raised if TangentFaces
-- The exception DomainError is raised if TangentFaces -- returns False.
-- returns False. ---C++: inline
returns Boolean from Standard returns Boolean from Standard
---C++: inline raises NotDone from StdFail,
DomainError from Standard
raises NotDone from StdFail, is static;
DomainError from Standard
is static;
NbPnts(me) NbPnts(me)
---Purpose: Returns the number of "single" points.
---Purpose: Returns the number of "single" points. ---C++: inline
returns Integer from Standard returns Integer from Standard
---C++: inline
raises NotDone from StdFail raises NotDone from StdFail
is static; is static;
@ -200,52 +213,46 @@ is
---Purpose: Returns the point of range Index. ---Purpose: Returns the point of range Index.
-- An exception is raised if Index<=0 or Index>NbPnt. -- An exception is raised if Index<=0 or Index>NbPnt.
---C++: return const&
---C++: inline
returns Point from IntPatch returns Point from IntPatch
---C++: return const& raises NotDone from StdFail,
---C++: inline OutOfRange from Standard
raises NotDone from StdFail,
OutOfRange from Standard
is static; is static;
NbLines(me) NbLines(me)
---Purpose: Returns the number of intersection lines.
---C++: inline
---Purpose: Returns the number of intersection lines. returns Integer from Standard
raises NotDone from StdFail
returns Integer from Standard is static;
---C++: inline
raises NotDone from StdFail
is static;
Line(me; Index: Integer from Standard) Line(me; Index: Integer from Standard)
---Purpose: Returns the line of range Index.
---Purpose: Returns the line of range Index.
-- An exception is raised if Index<=0 or Index>NbLine. -- An exception is raised if Index<=0 or Index>NbLine.
---C++: return const&
---C++: inline
returns Line from IntPatch returns Line from IntPatch
---C++: return const& raises NotDone from StdFail,
---C++: inline OutOfRange from Standard
raises NotDone from StdFail, is static;
OutOfRange from Standard
is static;
SequenceOfLine(me) SequenceOfLine(me)
returns SequenceOfLine from IntPatch ---C++: return const&
---C++: return const&
raises NotDone from StdFail
is static;
Dump(me; Mode: Integer from Standard; returns SequenceOfLine from IntPatch
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d; raises NotDone from StdFail
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d) is static;
Dump(me; Mode : Integer from Standard;
S1 : HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2 : HSurface from Adaptor3d; D2: TopolTool from Adaptor3d)
---Purpose: Dump of each result line. ---Purpose: Dump of each result line.
--- Mode for more accurate dumps. --- Mode for more accurate dumps.
-- --

File diff suppressed because it is too large Load Diff

View File

@ -25,13 +25,13 @@ class FaceFace from IntTools
uses uses
TopolTool from Adaptor3d, TopolTool from Adaptor3d,
HSurface from GeomAdaptor, HSurface from GeomAdaptor,
ListOfPntOn2S from IntSurf , ListOfPntOn2S from IntSurf ,
Intersection from IntPatch, Intersection from IntPatch,
Face from TopoDS, Face from TopoDS,
SequenceOfCurves from IntTools, SequenceOfCurves from IntTools,
LineConstructor from IntTools, LineConstructor from IntTools,
SequenceOfPntOn2Faces from IntTools, SequenceOfPntOn2Faces from IntTools,
Context from BOPInt Context from BOPInt

View File

@ -283,11 +283,8 @@ static
static static
void Tolerances(const Handle(GeomAdaptor_HSurface)& aHS1, void Tolerances(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2, const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Real& aTolArc, Standard_Real& aTolTang);
Standard_Real& aTolTang,
Standard_Real& aUVMaxStep,
Standard_Real& aDeflection);
static static
Standard_Boolean SortTypes(const GeomAbs_SurfaceType aType1, Standard_Boolean SortTypes(const GeomAbs_SurfaceType aType1,
@ -413,7 +410,7 @@ const IntTools_SequenceOfCurves& IntTools_FaceFace::Lines() const
{ {
StdFail_NotDone_Raise_if StdFail_NotDone_Raise_if
(!myIsDone, (!myIsDone,
"IntTools_FaceFace::Lines() => !myIntersector.IsDone()"); "IntTools_FaceFace::Lines() => myIntersector NOT DONE");
return mySeqOfCurve; return mySeqOfCurve;
} }
//======================================================================= //=======================================================================
@ -446,127 +443,209 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
{ {
myListOfPnts = aListOfPnts; myListOfPnts = aListOfPnts;
} }
static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
const TopoDS_Face& theF2)
{
const Standard_Real Tolang = 1.e-8;
const Standard_Real aTolF1=BRep_Tool::Tolerance(theF1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(theF2);
const Standard_Real aTolSum = aTolF1 + aTolF2;
Standard_Real aHigh = 0.0;
const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
const GeomAbs_SurfaceType aType1=aBAS1.GetType();
const GeomAbs_SurfaceType aType2=aBAS2.GetType();
gp_Pln aS1;
gp_Cylinder aS2;
if(aType1 == GeomAbs_Plane)
{
aS1=aBAS1.Plane();
}
else if(aType2 == GeomAbs_Plane)
{
aS1=aBAS2.Plane();
}
else
{
return Standard_True;
}
if(aType1 == GeomAbs_Cylinder)
{
aS2=aBAS1.Cylinder();
const Standard_Real VMin = aBAS1.FirstVParameter();
const Standard_Real VMax = aBAS1.LastVParameter();
if( Precision::IsNegativeInfinite(VMin) ||
Precision::IsPositiveInfinite(VMax))
return Standard_True;
else
aHigh = VMax - VMin;
}
else if(aType2 == GeomAbs_Cylinder)
{
aS2=aBAS2.Cylinder();
const Standard_Real VMin = aBAS2.FirstVParameter();
const Standard_Real VMax = aBAS2.LastVParameter();
if( Precision::IsNegativeInfinite(VMin) ||
Precision::IsPositiveInfinite(VMax))
return Standard_True;
else
aHigh = VMax - VMin;
}
else
{
return Standard_True;
}
IntAna_QuadQuadGeo inter;
inter.Perform(aS1,aS2,Tolang,aTolSum, aHigh);
if(inter.TypeInter() == IntAna_Ellipse)
{
const gp_Elips anEl = inter.Ellipse(1);
const Standard_Real aMajorR = anEl.MajorRadius();
const Standard_Real aMinorR = anEl.MinorRadius();
return (aMajorR < 100000.0 * aMinorR);
}
else
{
return inter.IsDone();
}
}
//======================================================================= //=======================================================================
//function : Perform //function : Perform
//purpose : intersect surfaces of the faces //purpose : intersect surfaces of the faces
//======================================================================= //=======================================================================
void IntTools_FaceFace::Perform(const TopoDS_Face& aF1, void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
const TopoDS_Face& aF2) const TopoDS_Face& aF2)
{ {
Standard_Boolean hasCone, RestrictLine, bTwoPlanes, bReverse; Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False;
Standard_Integer aNbLin, aNbPnts, i, NbLinPP;
Standard_Real TolArc, TolTang, Deflection, UVMaxStep;
Standard_Real umin, umax, vmin, vmax;
Standard_Real aTolF1, aTolF2;
GeomAbs_SurfaceType aType1, aType2;
Handle(Geom_Surface) S1, S2;
Handle(IntTools_TopolTool) dom1, dom2;
BRepAdaptor_Surface aBAS1, aBAS2;
//
if (myContext.IsNull()) { if (myContext.IsNull()) {
myContext=new BOPInt_Context; myContext=new BOPInt_Context;
} }
//
mySeqOfCurve.Clear(); mySeqOfCurve.Clear();
myTolReached2d=0.; myTolReached2d=0.;
myTolReached3d=0.; myTolReached3d=0.;
myIsDone = Standard_False; myIsDone = Standard_False;
myNbrestr=0;//? myNbrestr=0;//?
hasCone = Standard_False;
bTwoPlanes = Standard_False;
//
myFace1=aF1; myFace1=aF1;
myFace2=aF2; myFace2=aF2;
//
aBAS1.Initialize(myFace1, Standard_False); const BRepAdaptor_Surface aBAS1(myFace1, Standard_False);
aBAS2.Initialize(myFace2, Standard_False); const BRepAdaptor_Surface aBAS2(myFace2, Standard_False);
aType1=aBAS1.GetType(); GeomAbs_SurfaceType aType1=aBAS1.GetType();
aType2=aBAS2.GetType(); GeomAbs_SurfaceType aType2=aBAS2.GetType();
//
bReverse=SortTypes(aType1, aType2); const Standard_Boolean bReverse=SortTypes(aType1, aType2);
if (bReverse) { if (bReverse)
{
myFace1=aF2; myFace1=aF2;
myFace2=aF1; myFace2=aF1;
aType1=aBAS2.GetType(); aType1=aBAS2.GetType();
aType2=aBAS1.GetType(); aType2=aBAS1.GetType();
//
if (myListOfPnts.Extent()) { if (myListOfPnts.Extent())
{
Standard_Real aU1,aV1,aU2,aV2; Standard_Real aU1,aV1,aU2,aV2;
IntSurf_ListIteratorOfListOfPntOn2S aItP2S; IntSurf_ListIteratorOfListOfPntOn2S aItP2S;
// //
aItP2S.Initialize(myListOfPnts); aItP2S.Initialize(myListOfPnts);
for (; aItP2S.More(); aItP2S.Next()){ for (; aItP2S.More(); aItP2S.Next())
IntSurf_PntOn2S& aP2S=aItP2S.Value(); {
aP2S.Parameters(aU1,aV1,aU2,aV2); IntSurf_PntOn2S& aP2S=aItP2S.Value();
aP2S.SetValue(aU2,aV2,aU1,aV1); aP2S.Parameters(aU1,aV1,aU2,aV2);
aP2S.SetValue(aU2,aV2,aU1,aV1);
} }
} }
} }
//
S1=BRep_Tool::Surface(myFace1);
S2=BRep_Tool::Surface(myFace2);
//
aTolF1=BRep_Tool::Tolerance(myFace1);
aTolF2=BRep_Tool::Tolerance(myFace2);
//
TolArc= aTolF1 + aTolF2;
TolTang = TolArc;
//
NbLinPP = 0;
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane){
bTwoPlanes = Standard_True;
const Handle(Geom_Surface) S1=BRep_Tool::Surface(myFace1);
const Handle(Geom_Surface) S2=BRep_Tool::Surface(myFace2);
const Standard_Real aTolF1=BRep_Tool::Tolerance(myFace1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(myFace2);
Standard_Real TolArc = aTolF1 + aTolF2;
Standard_Real TolTang = TolArc;
const Standard_Boolean isFace1Quad = (aType1 == GeomAbs_Cylinder ||
aType1 == GeomAbs_Cone ||
aType1 == GeomAbs_Torus);
const Standard_Boolean isFace2Quad = (aType2 == GeomAbs_Cylinder ||
aType2 == GeomAbs_Cone ||
aType2 == GeomAbs_Torus);
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane)
{
Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// //
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
Standard_Real TolAng = 1.e-8; Standard_Real TolAng = 1.e-8;
PerformPlanes(myHS1, myHS2, TolAng, TolTang, myApprox1, myApprox2, PerformPlanes(myHS1, myHS2, TolAng, TolTang, myApprox1, myApprox2,
mySeqOfCurve, myTangentFaces); mySeqOfCurve, myTangentFaces);
myIsDone = Standard_True; myIsDone = Standard_True;
if(!myTangentFaces) { if(!myTangentFaces)
// {
NbLinPP = mySeqOfCurve.Length(); const Standard_Integer NbLinPP = mySeqOfCurve.Length();
if(NbLinPP) { if(NbLinPP)
Standard_Real aTolFMax; {
// Standard_Real aTolFMax;
myTolReached3d = 1.e-7; myTolReached3d = 1.e-7;
// aTolFMax=Max(aTolF1, aTolF2);
aTolFMax=Max(aTolF1, aTolF2); if (aTolFMax>myTolReached3d)
// {
if (aTolFMax>myTolReached3d) { myTolReached3d=aTolFMax;
myTolReached3d=aTolFMax; }
}
myTolReached2d = myTolReached3d; myTolReached2d = myTolReached3d;
//
if (bReverse) { if (bReverse)
Handle(Geom2d_Curve) aC2D1, aC2D2; {
// Handle(Geom2d_Curve) aC2D1, aC2D2;
aNbLin=mySeqOfCurve.Length(); const Standard_Integer aNbLin = mySeqOfCurve.Length();
for (i=1; i<=aNbLin; ++i) { for (Standard_Integer i = 1; i <= aNbLin; ++i)
IntTools_Curve& aIC=mySeqOfCurve(i); {
aC2D1=aIC.FirstCurve2d(); IntTools_Curve& aIC=mySeqOfCurve(i);
aC2D2=aIC.SecondCurve2d(); aC2D1=aIC.FirstCurve2d();
// aC2D2=aIC.SecondCurve2d();
aIC.SetFirstCurve2d(aC2D2); aIC.SetFirstCurve2d(aC2D2);
aIC.SetSecondCurve2d(aC2D1); aIC.SetSecondCurve2d(aC2D1);
} }
} }
} }
} }
return; return;
}//if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane){ }//if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane){
//
if (aType1==GeomAbs_Plane && if ((aType1==GeomAbs_Plane) && isFace2Quad)
(aType2==GeomAbs_Cylinder || {
aType2==GeomAbs_Cone ||
aType2==GeomAbs_Torus)) {
Standard_Real dU, dV; Standard_Real dU, dV;
// F1 // F1
Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
dU=0.1*(umax-umin); dU=0.1*(umax-umin);
dV=0.1*(vmax-vmin); dV=0.1*(vmax-vmin);
umin=umin-dU; umin=umin-dU;
@ -584,13 +663,12 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
hasCone = Standard_True; hasCone = Standard_True;
} }
} }
// else if ((aType2==GeomAbs_Plane) && isFace1Quad)
else if ((aType1==GeomAbs_Cylinder|| {
aType1==GeomAbs_Cone ||
aType1==GeomAbs_Torus) &&
aType2==GeomAbs_Plane) {
Standard_Real dU, dV; Standard_Real dU, dV;
//F1 //F1
Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax); CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
@ -609,80 +687,84 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
hasCone = Standard_True; hasCone = Standard_True;
} }
} }
else
// {
else { Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
//
CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax); CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
//
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
//
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
//
CorrectSurfaceBoundaries(myFace2, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax); CorrectSurfaceBoundaries(myFace2, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
//
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
} }
//
dom1 = new IntTools_TopolTool(myHS1); const Handle(IntTools_TopolTool) dom1 = new IntTools_TopolTool(myHS1);
dom2 = new IntTools_TopolTool(myHS2); const Handle(IntTools_TopolTool) dom2 = new IntTools_TopolTool(myHS2);
//
myLConstruct.Load(dom1, dom2, myHS1, myHS2); myLConstruct.Load(dom1, dom2, myHS1, myHS2);
//
Deflection = (hasCone) ? 0.085 : 0.1;
UVMaxStep = 0.001; Tolerances(myHS1, myHS2, TolTang);
//
Tolerances(myHS1, myHS2, TolArc, TolTang, UVMaxStep, Deflection); {
// const Standard_Real UVMaxStep = 0.001;
myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection); const Standard_Real Deflection = (hasCone) ? 0.085 : 0.1;
// myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection);
RestrictLine = Standard_False; }
//
if((myHS1->IsUClosed() && !myHS1->IsUPeriodic()) || if((myHS1->IsUClosed() && !myHS1->IsUPeriodic()) ||
(myHS1->IsVClosed() && !myHS1->IsVPeriodic()) || (myHS1->IsVClosed() && !myHS1->IsVPeriodic()) ||
(myHS2->IsUClosed() && !myHS2->IsUPeriodic()) || (myHS2->IsUClosed() && !myHS2->IsUPeriodic()) ||
(myHS2->IsVClosed() && !myHS2->IsVPeriodic())) { (myHS2->IsVClosed() && !myHS2->IsVPeriodic()))
{
RestrictLine = Standard_True; RestrictLine = Standard_True;
} }
// //
if(((aType1 != GeomAbs_BSplineSurface) && if((aType1 != GeomAbs_BSplineSurface) &&
(aType1 != GeomAbs_BezierSurface) && (aType1 != GeomAbs_BezierSurface) &&
(aType1 != GeomAbs_OtherSurface)) && (aType1 != GeomAbs_OtherSurface) &&
((aType2 != GeomAbs_BSplineSurface) && (aType2 != GeomAbs_BSplineSurface) &&
(aType2 != GeomAbs_BezierSurface) && (aType2 != GeomAbs_BezierSurface) &&
(aType2 != GeomAbs_OtherSurface))) { (aType2 != GeomAbs_OtherSurface))
{
RestrictLine = Standard_True; RestrictLine = Standard_True;
//
if ((aType1 == GeomAbs_Torus) || if ((aType1 == GeomAbs_Torus) ||
(aType2 == GeomAbs_Torus) ) { (aType2 == GeomAbs_Torus))
{
myListOfPnts.Clear(); myListOfPnts.Clear();
} }
} }
// //
if(!RestrictLine) { if(!RestrictLine)
{
TopExp_Explorer aExp; TopExp_Explorer aExp;
// for(Standard_Integer i = 0; (!RestrictLine) && (i < 2); i++)
for(i = 0; (!RestrictLine) && (i < 2); i++) { {
const TopoDS_Face& aF=(!i) ? myFace1 : myFace2; const TopoDS_Face& aF=(!i) ? myFace1 : myFace2;
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for(; aExp.More(); aExp.Next()) { for(; aExp.More(); aExp.Next())
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); {
// const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
if(BRep_Tool::Degenerated(aE)) {
RestrictLine = Standard_True; if(BRep_Tool::Degenerated(aE))
break; {
} RestrictLine = Standard_True;
break;
}
} }
} }
} }
//
myIntersector.Perform(myHS1, dom1, myHS2, dom2, const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2);
TolArc, TolTang, myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
myListOfPnts, RestrictLine); myListOfPnts, RestrictLine, isGeomInt);
//
myIsDone = myIntersector.IsDone(); myIsDone = myIntersector.IsDone();
if (myIsDone) {
if (myIsDone)
{
myTangentFaces=myIntersector.TangentFaces(); myTangentFaces=myIntersector.TangentFaces();
if (myTangentFaces) { if (myTangentFaces) {
return; return;
@ -692,8 +774,8 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
myListOfPnts.Clear(); // to use LineConstructor myListOfPnts.Clear(); // to use LineConstructor
} }
// //
aNbLin = myIntersector.NbLines(); const Standard_Integer aNbLin = myIntersector.NbLines();
for (i=1; i<=aNbLin; ++i) { for (Standard_Integer i=1; i <= aNbLin; ++i) {
MakeCurve(i, dom1, dom2); MakeCurve(i, dom1, dom2);
} }
// //
@ -702,43 +784,47 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
if (bReverse) { if (bReverse) {
Handle(Geom2d_Curve) aC2D1, aC2D2; Handle(Geom2d_Curve) aC2D1, aC2D2;
// //
aNbLin=mySeqOfCurve.Length(); const Standard_Integer aNbLin=mySeqOfCurve.Length();
for (i=1; i<=aNbLin; ++i) { for (Standard_Integer i=1; i<=aNbLin; ++i)
IntTools_Curve& aIC=mySeqOfCurve(i); {
aC2D1=aIC.FirstCurve2d(); IntTools_Curve& aIC=mySeqOfCurve(i);
aC2D2=aIC.SecondCurve2d(); aC2D1=aIC.FirstCurve2d();
// aC2D2=aIC.SecondCurve2d();
aIC.SetFirstCurve2d(aC2D2); aIC.SetFirstCurve2d(aC2D2);
aIC.SetSecondCurve2d(aC2D1); aIC.SetSecondCurve2d(aC2D1);
} }
} }
//
// Points // Points
Standard_Real U1,V1,U2,V2; Standard_Real U1,V1,U2,V2;
IntTools_PntOnFace aPntOnF1, aPntOnF2; IntTools_PntOnFace aPntOnF1, aPntOnF2;
IntTools_PntOn2Faces aPntOn2Faces; IntTools_PntOn2Faces aPntOn2Faces;
// //
aNbPnts=myIntersector.NbPnts(); const Standard_Integer aNbPnts = myIntersector.NbPnts();
for (i=1; i<=aNbPnts; ++i) { for (Standard_Integer i=1; i <= aNbPnts; ++i)
{
const IntSurf_PntOn2S& aISPnt=myIntersector.Point(i).PntOn2S(); const IntSurf_PntOn2S& aISPnt=myIntersector.Point(i).PntOn2S();
const gp_Pnt& aPnt=aISPnt.Value(); const gp_Pnt& aPnt=aISPnt.Value();
aISPnt.Parameters(U1,V1,U2,V2); aISPnt.Parameters(U1,V1,U2,V2);
aPntOnF1.Init(myFace1, aPnt, U1, V1); aPntOnF1.Init(myFace1, aPnt, U1, V1);
aPntOnF2.Init(myFace2, aPnt, U2, V2); aPntOnF2.Init(myFace2, aPnt, U2, V2);
// //
if (!bReverse) { if (!bReverse)
aPntOn2Faces.SetP1(aPntOnF1); {
aPntOn2Faces.SetP2(aPntOnF2); aPntOn2Faces.SetP1(aPntOnF1);
aPntOn2Faces.SetP2(aPntOnF2);
} }
else { else
aPntOn2Faces.SetP2(aPntOnF1); {
aPntOn2Faces.SetP1(aPntOnF2); aPntOn2Faces.SetP2(aPntOnF1);
aPntOn2Faces.SetP1(aPntOnF2);
} }
myPnts.Append(aPntOn2Faces); myPnts.Append(aPntOn2Faces);
} }
//
} }
} }
//======================================================================= //=======================================================================
//function :ComputeTolReached3d //function :ComputeTolReached3d
//purpose : //purpose :
@ -4656,11 +4742,8 @@ void ApproxParameters(const Handle(GeomAdaptor_HSurface)& aHS1,
//purpose : //purpose :
//======================================================================= //=======================================================================
void Tolerances(const Handle(GeomAdaptor_HSurface)& aHS1, void Tolerances(const Handle(GeomAdaptor_HSurface)& aHS1,
const Handle(GeomAdaptor_HSurface)& aHS2, const Handle(GeomAdaptor_HSurface)& aHS2,
Standard_Real& ,//aTolArc, Standard_Real& aTolTang)
Standard_Real& aTolTang,
Standard_Real& ,//aUVMaxStep,
Standard_Real& )//aDeflection)
{ {
GeomAbs_SurfaceType aTS1, aTS2; GeomAbs_SurfaceType aTS1, aTS2;
// //

View File

@ -1144,6 +1144,96 @@ static Standard_Integer OCC11758 (Draw_Interpretor& di, Standard_Integer n, cons
return 0; return 0;
} }
#include <Geom_CylindricalSurface.hxx>
#include <IntTools_FaceFace.hxx>
#include <IntTools_Curve.hxx>
#include <IntTools_PntOn2Faces.hxx>
static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
{
if(theNArg < 2)
{
theDI << "Wrong a number of arguments!\n";
return 1;
}
Handle_Geom_Plane plane(new Geom_Plane(
gp_Ax3( gp_Pnt(-72.948737453424499, 754.30437716359393, 259.52151854671678),
gp_Dir(6.2471473085930200e-007, -0.99999999999980493, 0.00000000000000000),
gp_Dir(0.99999999999980493, 6.2471473085930200e-007, 0.00000000000000000))));
Handle(Geom_CylindricalSurface) cylinder(
new Geom_CylindricalSurface(
gp_Ax3(gp_Pnt(-6.4812490053250649, 753.39408794522092, 279.16400974257465),
gp_Dir(1.0000000000000000, 0.0, 0.00000000000000000),
gp_Dir(0.0, 1.0000000000000000, 0.00000000000000000)),
19.712534607908712));
DrawTrSurf::Set("pln", plane);
theDI << "pln\n";
DrawTrSurf::Set("cyl", cylinder);
theDI << "cyl\n";
BRep_Builder builder;
TopoDS_Face face1, face2;
builder.MakeFace(face1, plane, Precision::Confusion());
builder.MakeFace(face2, cylinder, Precision::Confusion());
IntTools_FaceFace anInters;
anInters.SetParameters(false, true, true, Precision::Confusion());
anInters.Perform(face1, face2);
if (!anInters.IsDone())
{
theDI<<"No intersections found!"<<"\n";
return 1;
}
//Handle(Geom_Curve) aResult;
//gp_Pnt aPoint;
const IntTools_SequenceOfCurves& aCvsX=anInters.Lines();
const IntTools_SequenceOfPntOn2Faces& aPntsX=anInters.Points();
char buf[1024];
Standard_Integer aNbCurves, aNbPoints;
aNbCurves=aCvsX.Length();
aNbPoints=aPntsX.Length();
if (aNbCurves >= 2)
{
for (Standard_Integer i=1; i<=aNbCurves; ++i)
{
Sprintf(buf, "%s_%d",theArgv[1],i);
theDI << buf << " ";
const IntTools_Curve& aIC = aCvsX(i);
const Handle(Geom_Curve)& aC3D= aIC.Curve();
DrawTrSurf::Set(buf,aC3D);
}
}
else if (aNbCurves == 1)
{
const IntTools_Curve& aIC = aCvsX(1);
const Handle(Geom_Curve)& aC3D= aIC.Curve();
Sprintf(buf, "%s",theArgv[1]);
theDI << buf << " ";
DrawTrSurf::Set(buf,aC3D);
}
for (Standard_Integer i = 1; i<=aNbPoints; ++i)
{
const IntTools_PntOn2Faces& aPi=aPntsX(i);
const gp_Pnt& aP=aPi.P1().Pnt();
Sprintf(buf,"%s_p_%d",theArgv[1],i);
theDI << buf << " ";
DrawTrSurf::Set(buf, aP);
}
return 0;
}
void QABugs::Commands_19(Draw_Interpretor& theCommands) { void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs"; const char *group = "QABugs";
@ -1163,6 +1253,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
theCommands.Add("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group); theCommands.Add("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group); theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group); theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
return; return;
} }

35
tests/bugs/modalg_5/bug24005 Executable file
View File

@ -0,0 +1,35 @@
puts "============"
puts "OCC24005"
puts "============"
puts ""
###############################
## Intersecting a slightly off angle plane with a cylinder takes 7+ seconds
###############################
pload QAcommands
dchrono h reset
dchrono h start
OCC24005 result
dchrono h stop
set q [dchrono h show]
regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full z
puts "$z"
set max_time 0.1
if { $z > ${max_time} } {
puts "Elapsed time is more than ${max_time} seconds - Faulty"
} else {
puts "Elapsed time is less than ${max_time} seconds - OK"
}
if { [regexp {Ellipse} [dump result]] == 1 } {
puts "result is OK"
} else {
puts "result is Faulty"
}
set 2dviewer 1