]> OCCT Git - occt.git/commitdiff
0028261: Chamfer fails on edge connected to cone's seam
authorifv <ifv@opencascade.com>
Thu, 26 Jan 2017 10:19:20 +0000 (13:19 +0300)
committerapn <apn@opencascade.com>
Thu, 26 Jan 2017 10:19:44 +0000 (13:19 +0300)
Method GetType() of class GeomAdaptor_SurfaceOfRevolution was modified to create plane instead Cone or SurfaceOfRevolution for "plane like" within Precision::Confusion() restricted object.
For infinite objects Cone with semiangle > PI/2 - eps is replaced by SurfaceOfRevolution for eps < Precision::Confusion()
Tests cases are added

Small correction of shape names for issue CR28261_28266

src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx
tests/bugs/modalg_6/bug28261 [new file with mode: 0644]
tests/bugs/modalg_6/bug28266 [new file with mode: 0644]

index 336ff024a98d997847cc7af0cf8163de06884edd..c6dc7b67072525611324d3ff5912b7e0c217ce41 100644 (file)
@@ -401,13 +401,21 @@ GeomAbs_SurfaceType GeomAdaptor_SurfaceOfRevolution::GetType() const
 {
   Standard_Real TolConf = Precision::Confusion();
   Standard_Real TolAng  = Precision::Angular();
+  Standard_Real TolConeSemiAng = Precision::Confusion();
 
   switch (myBasisCurve->GetType()) {
   case GeomAbs_Line:    {
     gp_Ax1 Axe = myBasisCurve->Line().Position();
     
     if (myAxis.IsParallel(Axe, TolAng))
-      return GeomAbs_Cylinder;
+    {
+      gp_Pnt P = Value(0., 0.);
+      Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
+      if (R > TolConf)
+      {
+        return GeomAbs_Cylinder;
+      }
+    }
     else if (myAxis.IsNormal(Axe, TolAng))
       return GeomAbs_Plane;
     else
@@ -425,16 +433,27 @@ GeomAbs_SurfaceType GeomAdaptor_SurfaceOfRevolution::GetType() const
         gp_Vec vlin(pf,pl);
         gp_Vec vaxe(myAxis.Direction());
         Standard_Real projlen = Abs(vaxe.Dot(vlin));
-        Standard_Real aTolConf = len*TolAng;
-        if ((len - projlen) <= aTolConf)
-          return GeomAbs_Cylinder;
-        else if (projlen <= aTolConf)
+        if ((len - projlen) <= TolConf)
+        {
+          gp_Pnt P = Value(0., 0.);
+          Standard_Real R = gp_Vec(myAxeRev.Location(), P) * myAxeRev.XDirection();
+          if (R > TolConf)
+          {
+            return GeomAbs_Cylinder;
+          }
+        }
+        else if (projlen <= TolConf)
           return GeomAbs_Plane;
       }
       gp_Vec V(myAxis.Location(), myBasisCurve->Line().Location());
       gp_Vec W(Axe.Direction());
-      if (Abs(V.DotCross(myAxis.Direction(), W)) <= TolConf)
+      gp_Vec AxisDir(myAxis.Direction());
+      Standard_Real proj = Abs(W.Dot(AxisDir));
+      if (Abs(V.DotCross(AxisDir, W)) <= TolConf &&
+        (proj >= TolConeSemiAng && proj <= 1. - TolConeSemiAng))
+      {
         return GeomAbs_Cone;
+      }
     }
     break;
   }//case GeomAbs_Line: 
diff --git a/tests/bugs/modalg_6/bug28261 b/tests/bugs/modalg_6/bug28261
new file mode 100644 (file)
index 0000000..8a2a6d7
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========"
+puts "OCC28261"
+puts "========"
+puts ""
+#################################################
+# Chamfer fails on edges placed on quasi-planar cone
+#################################################
+
+brestore [locate_data_file bug28261_face.brep] f
+brestore [locate_data_file bug28261_hexaprism.brep] h
+
+explode f E
+mkcurve c f_1
+cvalue c 0 x y z dx dy dz
+revol rev f $x $y $z $dx $dy $dz 360
+
+bcut r rev h
+
+explode r F
+explode r_9 E
+chamf r r r_9_1 r_9 0.1 0.1  r_9_2 r_9 0.1 0.1  r_9_3 r_9 0.1 0.1  r_9_4 r_9 0.1 0.1  r_9_5 r_9 0.1 0.1  r_9_6 r_9 0.1 0.1
+
+explode r F
+explode r_4 E
+chamf result r r_4_1 r_4 0.1 0.1  r_4_2 r_4 0.1 0.1  r_4_3 r_4 0.1 0.1  r_4_4 r_4 0.1 0.1  r_4_5 r_4 0.1 0.1  r_4_6 r_4 0.1 0.1  r_4_8 r_4 0.1 0.1
+
+checkshape result
+checknbshapes result -solid 1 -face 18 -edge 36 -vertex 22
+checkprops result -v 17158.1 -s 4073.25 
\ No newline at end of file
diff --git a/tests/bugs/modalg_6/bug28266 b/tests/bugs/modalg_6/bug28266
new file mode 100644 (file)
index 0000000..49230e5
--- /dev/null
@@ -0,0 +1,28 @@
+puts "========"
+puts "OCC28266"
+puts "========"
+puts ""
+#################################################
+# Boolean CUT produces incorrect result with quasi-planar cone
+#################################################
+
+brestore [locate_data_file bug28261_face.brep] f
+brestore [locate_data_file bug28266_tool1.brep] t1
+brestore [locate_data_file bug28266_tool2.brep] t2
+
+explode f E
+mkcurve c f_1
+cvalue c 0 x y z dx dy dz
+revol rev f $x $y $z $dx $dy $dz 360
+
+bcut r rev t1
+
+checkshape r
+checknbshapes r -solid 1 -face 86 -edge 267 -vertex 184
+checkprops r -v 17215.5 -s 4033.34
+
+bcut result r t2
+
+checkshape result
+checknbshapes result -solid 1 -face 90 -edge 278 -vertex 190
+checkprops result -v 17215.5 -s 4033.52
\ No newline at end of file