]> OCCT Git - occt-copy.git/commitdiff
0028724: Extrema between circle and plane cannot be found
authornbv <nbv@opencascade.com>
Wed, 10 May 2017 14:22:18 +0000 (17:22 +0300)
committernbv <nbv@opencascade.com>
Mon, 15 May 2017 07:54:26 +0000 (10:54 +0300)
The main reason of the regression is that the Extrema algorithm finds the truth extrema point but cannot adjust it to the range of given circle. It is connected with the fact that Geom(2d)Adaptor_Curve::IsPeriodic() method returns false for given circle because adaptor contains a piece of the circle which is not closed.

New algorithm of IsPeriodic() method will return the information about periodicity of the curve itself (independently of first and last parameter of adaptor).

The documentation about Geom(2d)_TrimmedCurve and Geom_RectangularTrimmedSurface has been updated in frame of the information about IsPeriodic-methods.

(cherry picked from commit b3cba642626bf141475c6e614fdc1df5e93cfcf7)

src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx
src/GeomAdaptor/GeomAdaptor_Curve.cxx
src/GeomFill/GeomFill_NSections.cxx
tests/bugs/modalg_6/bug28724 [new file with mode: 0644]

index e9e2013a53131214b02091e7bff8487de414da1c..1bae7542c6094b54cca599b2e93e7459492eb26d 100644 (file)
@@ -500,10 +500,7 @@ Standard_Boolean Geom2dAdaptor_Curve::IsClosed() const
 
 Standard_Boolean Geom2dAdaptor_Curve::IsPeriodic() const 
 {
-  if (myCurve->IsPeriodic())
-    return IsClosed();
-  else
-    return Standard_False;
+  return myCurve->IsPeriodic();
 }
 
 //=======================================================================
index b6cb7bd4ed750635bdd32b8fd8266149b7ebd097..6d68a9dcaf5f331fbfe4b2538d64db7fe654ce19 100644 (file)
@@ -495,7 +495,7 @@ Standard_Boolean GeomAdaptor_Curve::IsClosed() const
 
 Standard_Boolean GeomAdaptor_Curve::IsPeriodic() const 
 {
-  return (myCurve->IsPeriodic()? IsClosed() : Standard_False);
+  return myCurve->IsPeriodic();
 }
 
 //=======================================================================
index 1b02a345bed0a7088b45da283e00946757411d8d..2940bfae30fb70dad9a29445e5d2b6a6ccb24744 100644 (file)
@@ -968,9 +968,14 @@ void GeomFill_NSections::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
 
   C1.SetRadius(radius);
   Handle(Geom_Curve) C = new (Geom_Circle) (C1);
-  if (! AC1.IsPeriodic()) {
-    Handle(Geom_Curve) Cbis = new (Geom_TrimmedCurve) 
-      (C, AC1.FirstParameter(),  AC1.LastParameter());
+
+  const Standard_Real aParF = AC1.FirstParameter();
+  const Standard_Real aParL = AC1.LastParameter();
+  const Standard_Real aPeriod = AC1.IsPeriodic() ? AC1.Period() : 0.0;
+
+  if ((aPeriod == 0.0) || (Abs(aParL - aParF - aPeriod) > Precision::PConfusion()))
+  {
+    Handle(Geom_Curve) Cbis = new Geom_TrimmedCurve(C, aParF, aParL);
     C = Cbis;
   }
   return C;
diff --git a/tests/bugs/modalg_6/bug28724 b/tests/bugs/modalg_6/bug28724
new file mode 100644 (file)
index 0000000..3626c08
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "OCC28724"
+puts "========"
+puts ""
+##############################################
+# Extrema between circle and plane cannot be found
+##############################################
+
+restore [locate_data_file bug28724_cmpd.brep] co
+explode co
+
+distmini d co_1 co_2
+
+if {[dval d_val] > 1.0e-7} {
+  puts "Error: Extrema cannot find minimal distance"
+}
\ No newline at end of file