From 9a5a19e98f025ef0c955b01408d2a7b23b5679ba Mon Sep 17 00:00:00 2001 From: pkv Date: Thu, 5 Mar 2015 15:02:49 +0300 Subject: [PATCH] 0025818: IntTools_FaceFace throws Standard_ConstructionError with two unbounded planes Changes: class IntTools_FaceFace - method: void IntTools_FaceFace::Perform(const TopoDS_Face& aF1, const TopoDS_Face& aF2) The treatment of infinite planes was corrected. Test case for issue CR25818 --- src/IntTools/IntTools_FaceFace.cxx | 74 ++++++++++++++++-------------- tests/bugs/modalg_5/bug25818 | 18 ++++++++ 2 files changed, 58 insertions(+), 34 deletions(-) create mode 100755 tests/bugs/modalg_5/bug25818 diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index d8b2eab11d..d96acc3183 100644 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -303,6 +303,12 @@ static const TopoDS_Face& theFace, const Handle(IntTools_Context)& theContext); +static + void CorrectPlaneBoundaries(Standard_Real& aUmin, + Standard_Real& aUmax, + Standard_Real& aVmin, + Standard_Real& aVmax); + //======================================================================= //function : //purpose : @@ -503,7 +509,7 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1, //function : Perform //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) { Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False; @@ -573,24 +579,13 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1, if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) { Standard_Real umin, umax, vmin, vmax; - Standard_Real dU, dV; // BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); - dU=0.1*(umax-umin); - dV=0.1*(vmax-vmin); - umin=umin-dU; - umax=umax+dU; - vmin=vmin-dV; - vmax=vmax+dV; + CorrectPlaneBoundaries(umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); // BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); - dU=0.1*(umax-umin); - dV=0.1*(vmax-vmin); - umin=umin-dU; - umax=umax+dU; - vmin=vmin-dV; - vmax=vmax+dV; + CorrectPlaneBoundaries(umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); // Standard_Real TolAng = 1.e-8; @@ -630,18 +625,10 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1, if ((aType1==GeomAbs_Plane) && isFace2Quad) { - Standard_Real dU, dV; - - // F1 Standard_Real umin, umax, vmin, vmax; - BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); - - dU=0.1*(umax-umin); - dV=0.1*(vmax-vmin); - umin=umin-dU; - umax=umax+dU; - vmin=vmin-dV; - vmax=vmax+dV; + // F1 + BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); + CorrectPlaneBoundaries(umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); // F2 BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); @@ -655,21 +642,14 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1, } else if ((aType2==GeomAbs_Plane) && isFace1Quad) { - Standard_Real dU, dV; - - //F1 Standard_Real umin, umax, vmin, vmax; + //F1 BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); // F2 BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); - dU=0.1*(umax-umin); - dV=0.1*(vmax-vmin); - umin=umin-dU; - umax=umax+dU; - vmin=vmin-dV; - vmax=vmax+dV; + CorrectPlaneBoundaries(umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); // if( aType1==GeomAbs_Cone ) { @@ -4988,3 +4968,29 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC, } return !bRet; } +//======================================================================= +//function : CorrectPlaneBoundaries +//purpose : +//======================================================================= + void CorrectPlaneBoundaries(Standard_Real& aUmin, + Standard_Real& aUmax, + Standard_Real& aVmin, + Standard_Real& aVmax) +{ + if (!(Precision::IsInfinite(aUmin) || + Precision::IsInfinite(aUmax))) { + Standard_Real dU; + // + dU=0.1*(aUmax-aUmin); + aUmin=aUmin-dU; + aUmax=aUmax+dU; + } + if (!(Precision::IsInfinite(aVmin) || + Precision::IsInfinite(aVmax))) { + Standard_Real dV; + // + dV=0.1*(aVmax-aVmin); + aVmin=aVmin-dV; + aVmax=aVmax+dV; + } +} diff --git a/tests/bugs/modalg_5/bug25818 b/tests/bugs/modalg_5/bug25818 new file mode 100755 index 0000000000..517ce67e14 --- /dev/null +++ b/tests/bugs/modalg_5/bug25818 @@ -0,0 +1,18 @@ +puts "============" +puts "OCC25818" +puts "============" +puts "" +####################################################################### +# IntTools_FaceFace throws Standard_ConstructionError with two unbounded planes +####################################################################### + +plane pn1 0 0 0 0 0 1 1 0 0 +plane pn2 0 0 0 1 0 0 0 1 0 +mkface f1 pn1 +mkface f2 pn2 + +bopcurves f1 f2 + +smallview +fit +set only_screen_axo 1