From: emv Date: Thu, 21 Nov 2013 09:33:12 +0000 (+0400) Subject: 0024328: Revolution of a wire generates two interfered faces. X-Git-Tag: V6_7_0~67 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=b92a64cc68a903016a40f775e785a51a42f96135 0024328: Revolution of a wire generates two interfered faces. Correct treatment of cones with collinear axes. Test case for issue CR24328 --- diff --git a/src/BOPTools/BOPTools_AlgoTools.cxx b/src/BOPTools/BOPTools_AlgoTools.cxx index c9e24b836a..f0c6145f32 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cxx +++ b/src/BOPTools/BOPTools_AlgoTools.cxx @@ -31,6 +31,7 @@ #include #include #include +#include // #include #include @@ -1853,9 +1854,11 @@ Standard_Boolean FindPointInFace(const TopoDS_Edge& aE, case GeomAbs_Cylinder: aR = aBAS.Cylinder().Radius(); break; - case GeomAbs_Cone: - aR = aBAS.Cone().RefRadius(); + case GeomAbs_Cone: { + gp_Lin aL(aBAS.Cone().Axis()); + aR = aL.Distance(aP); break; + } case GeomAbs_Sphere: aR = aBAS.Sphere().Radius(); break; diff --git a/src/IntPatch/IntPatch_Intersection.cxx b/src/IntPatch/IntPatch_Intersection.cxx index 842d53c54b..a6e156c507 100755 --- a/src/IntPatch/IntPatch_Intersection.cxx +++ b/src/IntPatch/IntPatch_Intersection.cxx @@ -784,21 +784,17 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, } //// modified by jgv, 15.12.02 for OCC565 //// - if (typs1 == GeomAbs_Cone) + if (typs1 == GeomAbs_Cone && TreatAsBiParametric) { const gp_Cone Con1 = theS1->Cone(); const Standard_Real a1 = Abs(Con1.SemiAngle()); - if (a1 < 0.02 && a2 < 0.02) //quasi-cylinders: if same domain, treat as canonic + //if collinear, treat as canonical + const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); + const gp_Lin L1(A1); + if (A1.IsParallel(A2,Precision::Angular()) && + (L1.Distance(A2.Location()) <= Precision::Confusion())) { - const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); - if (A1.IsParallel(A2,Precision::Angular())) - { - const gp_Lin L1(A1); - if (L1.Distance(A2.Location()) <= Precision::Confusion()) - { - TreatAsBiParametric = Standard_False; - } - } + TreatAsBiParametric = Standard_False; } else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic { @@ -813,14 +809,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, } } } - else if ((a1 > 1.55) || (a2 > 1.55)) - { - const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); - if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion())) - { - TreatAsBiParametric = Standard_False; - } - } }// if (typs1 == GeomAbs_Cone) { }// if(typs2 == GeomAbs_Cone) { @@ -984,21 +972,17 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, } //// modified by jgv, 15.12.02 for OCC565 //// - if (typs1 == GeomAbs_Cone) + if (typs1 == GeomAbs_Cone && TreatAsBiParametric) { const gp_Cone Con1 = theS1->Cone(); const Standard_Real a1 = Abs(Con1.SemiAngle()); - if (a1 < 0.02 && a2 < 0.02) //quasi-cylinders: if same domain, treat as canonic + //if collinear, treat as canonical + const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); + const gp_Lin L1(A1); + if (A1.IsParallel(A2,Precision::Angular()) && + (L1.Distance(A2.Location()) <= Precision::Confusion())) { - const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); - if (A1.IsParallel(A2,Precision::Angular())) - { - const gp_Lin L1(A1); - if (L1.Distance(A2.Location()) <= Precision::Confusion()) - { - TreatAsBiParametric = Standard_False; - } - } + TreatAsBiParametric = Standard_False; } else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic { @@ -1013,14 +997,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1, } } } - else if ((a1 > 1.55) || (a2 > 1.55)) - { - const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); - if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion())) - { - TreatAsBiParametric = Standard_False; - } - } }// if (typs1 == GeomAbs_Cone) { }// if(typs2 == GeomAbs_Cone) { diff --git a/tests/bugs/modalg_5/bug24328 b/tests/bugs/modalg_5/bug24328 new file mode 100644 index 0000000000..6a4504bdde --- /dev/null +++ b/tests/bugs/modalg_5/bug24328 @@ -0,0 +1,23 @@ +puts "================" +puts "OCC24328" +puts "================" +puts "" +####################################################################### +# Revolution of a wire generates two interfered faces +####################################################################### + +vertex v1 23.500000 11.123000 0 +vertex v2 22.000000 11.140900 0 +vertex v3 20.500000 11.180700 0 +edge e1 v1 v2 +edge e2 v2 v3 +wire w e1 e2 +revol r w 0 0 0 1 0 0 360 + +set info [bopcheck r] + +if { [regexp "This shape seems to be OK" ${info}] != 1 } { + puts "Error : Revolution works wrong" +} else { + puts "OK: Revolution works properly" +}