diff --git a/src/IntAna/IntAna_QuadQuadGeo.cxx b/src/IntAna/IntAna_QuadQuadGeo.cxx index f015b93223..79a3ed250f 100644 --- a/src/IntAna/IntAna_QuadQuadGeo.cxx +++ b/src/IntAna/IntAna_QuadQuadGeo.cxx @@ -2473,33 +2473,32 @@ void IntAna_QuadQuadGeo::Perform(const gp_Torus& Tor1, aRMaj1 = Tor1.MajorRadius(); aRMin2 = Tor2.MinorRadius(); aRMaj2 = Tor2.MajorRadius(); - if (aRMin1 >= aRMaj1 || aRMin2 >= aRMaj2) { - typeres = IntAna_NoGeometricSolution; - return; - } // - const gp_Ax1 anAx1 = Tor1.Axis(); - const gp_Ax1 anAx2 = Tor2.Axis(); + const gp_Ax1& anAx1 = Tor1.Axis(); + const gp_Ax1& anAx2 = Tor2.Axis(); + // + const gp_Pnt& aLoc1 = anAx1.Location(); + const gp_Pnt& aLoc2 = anAx2.Location(); // gp_Lin aL1(anAx1); if (!anAx1.IsParallel(anAx2, myEPSILON_AXES_PARA) || - (aL1.Distance(anAx2.Location()) > myEPSILON_DISTANCE)) { + (aL1.Distance(aLoc2) > myEPSILON_DISTANCE)) { typeres = IntAna_NoGeometricSolution; return; } // - gp_Pnt aLoc1, aLoc2; - // - aLoc1 = anAx1.Location(); - aLoc2 = anAx2.Location(); - // if (aLoc1.IsEqual(aLoc2, Tol) && - (Abs(aRMin1 - aRMin2) <= Tol) && + (Abs(aRMin1 - aRMin2) <= Tol) && (Abs(aRMaj1 - aRMaj2) <= Tol)) { typeres = IntAna_Same; return; } // + if (aRMin1 >= aRMaj1 || aRMin2 >= aRMaj2) { + typeres = IntAna_NoGeometricSolution; + return; + } + // Standard_Real aDist; gp_Pnt aP1, aP2; // diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index cea146a9f4..f749781335 100644 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -1072,7 +1072,9 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, bToCheck = aTor1.MajorRadius() > aTor1.MinorRadius(); if (typs1 == typs2) { const gp_Torus aTor2 = aGeomSurf->Torus(); - bToCheck = aTor2.MajorRadius() > aTor2.MinorRadius(); + bToCheck = (bToCheck && (aTor2.MajorRadius() > aTor2.MinorRadius())) || + (Abs(aTor1.MajorRadius() - aTor2.MajorRadius()) < TolTang && + Abs(aTor1.MinorRadius() - aTor2.MinorRadius()) < TolTang); } // if (aCTType == GeomAbs_Torus) { diff --git a/tests/bugs/modalg_7/bug30100_1 b/tests/bugs/modalg_7/bug30100_1 new file mode 100644 index 0000000000..7cb3882d83 --- /dev/null +++ b/tests/bugs/modalg_7/bug30100_1 @@ -0,0 +1,12 @@ +puts "========" +puts "0030100: Modeling Algorithms - ShapeUpgrade_UnifySameDomain is unable to unify faces based on the same toroidal surface" +puts "========" +puts "" + +restore [locate_data_file bug30100_usd.brep] s +unifysamedom result s +checkshape result +checknbshapes result -wire 1 -face 1 +checkprops result -s 142506 + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug30100_2 b/tests/bugs/modalg_7/bug30100_2 new file mode 100644 index 0000000000..831cc1e8c5 --- /dev/null +++ b/tests/bugs/modalg_7/bug30100_2 @@ -0,0 +1,11 @@ +puts "========" +puts "0030100: Modeling Algorithms - ShapeUpgrade_UnifySameDomain is unable to unify faces based on the same toroidal surface" +puts "========" +puts "" + +restore [locate_data_file bug30100_faces.brep] f +explode f + +if {![regexp "no 3d curves" [bopcurves f_1 f_2]]} { + puts "Error: Tangent faces are not detected" +}