]> OCCT Git - occt-copy.git/commitdiff
0026651: IntTools_FClass2d gives incorrect result of classification
authorsan <san@opencascade.com>
Thu, 24 Sep 2015 14:46:07 +0000 (17:46 +0300)
committersan <san@opencascade.com>
Thu, 24 Sep 2015 14:46:07 +0000 (17:46 +0300)
src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx

index 8e7c84c1492bf77f4a00ed951beb89089232ba08..7cc20d6338a82ce2b6a7d88d213ee7a0c915ab75 100644 (file)
@@ -42,6 +42,18 @@ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d&
     nbs = (Standard_Integer)anb;
     if(nbs < 4.0) nbs=4;
   }
+  else if (typC == GeomAbs_Circle)
+  {
+    //Try to reach deflection = eps*R, eps = 0.01
+    const Standard_Real minR = 1.; //eps = 0.01
+    Standard_Real R = C.Circle().Radius();
+    if(R > minR)
+    {
+      Standard_Real angl = 0.283079; //2.*ACos(1. - eps);
+      Standard_Integer n = RealToInt(Abs(U1 - U0) / angl);
+      nbs = Max(n, nbs);
+    }
+  }
 
   if(nbs>300)
     nbs = 300;
@@ -50,7 +62,22 @@ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d&
 }
 //============================================================
 Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C) { 
-    return C.NbSamples();
+  Standard_Integer nbs = C.NbSamples();
+  GeomAbs_CurveType typC = C.GetType();
+  if (typC == GeomAbs_Circle)
+  {
+    //Try to reach deflection = eps*R, eps = 0.01
+    const Standard_Real minR = 1.; //eps = 0.01
+    Standard_Real R = C.Circle().Radius();
+    if(R > minR)
+    {
+      Standard_Real angl = 0.283079; //2.*ACos(1. - eps);
+      Standard_Integer n = RealToInt((C.LastParameter()-C.FirstParameter()) / angl);
+      nbs = Max(n, nbs);
+    }
+  }
+
+  return nbs;
  }