]> 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)
committerabv <abv@opencascade.com>
Thu, 18 May 2017 13:56:42 +0000 (16:56 +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.

dox/dev_guides/upgrade/upgrade.md
src/Geom/Geom_RectangularTrimmedSurface.hxx
src/Geom/Geom_TrimmedCurve.hxx
src/Geom2d/Geom2d_TrimmedCurve.hxx
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 060f3801d3b1b28efe823f5a50391dda900828a5..0cc82dc53cf1b427f7fc170e095902bd489e821d 100644 (file)
@@ -1262,15 +1262,17 @@ The following Grid management methods within class V3d_Viewer do not implicitly
   - *IntTools_Curve::Tolerance()* - returns the valid tolerance for the curve;
   - *IntTools_Curve::TangentialTolerance()* - returns the tangential tolerance, which reflects the size of the common between faces.
 * 2d tolerance (*IntTools_FaceFace::TolReached2d()*) has been completely removed from the algorithm as unused.
+
+
 @subsection upgrade_720_persistence Restore OCCT 6.9.1 persistence
   
-Capability of reading / writing files in old format using *Storage_ShapeSchema* functionality from OCCT 6.9.1 has been restored in OCCT 7.2.0. 
+The capability of reading / writing files in old format using *Storage_ShapeSchema* functionality from OCCT 6.9.1 has been restored in OCCT 7.2.0. 
 
 One can use this functionality in two ways:
-- invoke DRAW Test Harness commands fsdread / fsdwrite for shapes
-- call *StdStorage* class Read / Write functions in custom code
+- invoke DRAW Test Harness commands *fsdread / fsdwrite* for shapes;
+- call *StdStorage* class *Read / Write* functions in custom code.
 
-Code example below demonstrates how to read shapes from a storage driver using *StdStorage* class. 
+The code example below demonstrates how to read shapes from a storage driver using *StdStorage* class. 
 
 ~~~~
 // aDriver should be created and opened for reading
@@ -1363,11 +1365,17 @@ if (anError != Storage_VSOk)
 
 @subsection upgrade_720_Change_In_BRepLib_MakeFace_Algo Change in BRepLib_MakeFace algorithm
 
-  Previously, BRepLib_MakeFace algorithm changed orientation of the source wire in order to avoid creation of face as a hole (i.e. it is impossible to create single face as hole; hole can be created in context of another face only). New algorithm does not reverse the wire if it is open. Material of the face for open wire will be located on the left side from the source wire.
+  Previously, *BRepLib_MakeFace* algorithm changed orientation of the source wire in order to avoid creation of face as a hole (i.e. it is impossible to create the entire face as a hole; the hole can be created in context of another face only). New algorithm does not reverse the wire if it is open. Material of the face for the open wire will be located on the left side from the source wire.
 
 @subsection upgrade_720_Change_In_BRepFill_OffsetWire Change in BRepFill_OffsetWire algorithm
 
-  Now, offset direction will always be to outer region in case of positive offset value and to inner region in case of negative offset value.
-  Inner/Outer region for open wire is defined by the following rule:
-    when we go along the wire (taking into account edges orientation) then outer region will be on the right side, inner region will be on the left side.
-  In case of closed wire, inner region will always be inside the wire (at that, edges orientation is not taken into account).
\ No newline at end of file
+  From now on, the offset  will always be directed to the outer region in case of positive offset value and to the inner region in case of negative offset value.
+  Inner/Outer region for an open wire is defined by the following rule:
+    when we go along the wire (taking into account edges orientation) the outer region will be on the right side, the inner region will be on the left side.
+  In case of a closed wire, the inner region will always be inside the wire (at that, the edges orientation is not taken into account).
+  
+@subsection upgrade_720_Change_In_GeomAdaptor_Curve Change in Geom(2d)Adaptor_Curve::IsPeriodic
+  
+Since 7.2.0 version, method *IsPeriodic()* returns the corresponding status of periodicity of the basis curve regardless of closure status of the adaptor curve (see method *IsClosed()*).
+Method *IsClosed()* for adaptor can return false even on periodic curve, in the case if its parametric range is not full period, e.g. for adaptor on circle in range [0, @f$ \pi @f$].
+In previous versions, *IsPeriodic()* always returned false if *IsClosed()* returned false.
index a7144e0ae747aad119eddd1dc4206f19b9b13c90..857797370bc2081f27819ab1495e4ed4ee779054 100644 (file)
@@ -205,7 +205,7 @@ public:
   //! Raised if N < 0.
   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
   
-  //! Returns true if this patch is periodic in the given
+  //! Returns true if this patch is periodic and not trimmed in the given
   //! parametric direction.
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
@@ -215,7 +215,7 @@ public:
   Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE;
   
 
-  //! Returns true if this patch is periodic in the given
+  //! Returns true if this patch is periodic and not trimmed in the given
   //! parametric direction.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
index 32cef493dd74f22148d5f2ff1a2ceb57413bc0c7..76569080707c9e507e2c00439a48d1bcaf8d08e2 100644 (file)
@@ -173,7 +173,7 @@ public:
   //! the EndPoint is lower or equal to Resolution from package gp.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! Returns true if the basis curve of this trimmed curve is periodic.
+  //! Always returns FALSE (independently of the type of basis curve).
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of the basis curve of this trimmed curve.
index 08e9b5e5ea515a5481d034c611e7f30ba8c0fa72..57e905fb25f72cbd93efa943c914461dac85de18 100644 (file)
@@ -172,7 +172,7 @@ public:
   //! gp.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! Returns true if the basis curve of this trimmed curve is periodic.
+  //! Always returns FALSE (independently of the type of basis curve).
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of the basis curve of this trimmed curve.
index 389cdce558c73a65484b729b656ec05085a8b6fa..e4a30742f27f62202e5a14e4a90d73f9322cd88e 100644 (file)
@@ -530,10 +530,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 217891e6fae78d3367d3ebc69e9a5bf909b56b1e..112a3eb6f9eace70365499bb64514b6b2f980e64 100644 (file)
@@ -511,7 +511,7 @@ Standard_Boolean GeomAdaptor_Curve::IsClosed() const
 
 Standard_Boolean GeomAdaptor_Curve::IsPeriodic() const 
 {
-  return (myCurve->IsPeriodic()? IsClosed() : Standard_False);
+  return myCurve->IsPeriodic();
 }
 
 //=======================================================================
index 48d597f0e5026cd3866e399da4e404bdb7d56d75..07a69e3c661f7525e4f80ffe14b16440606d4d3c 100644 (file)
@@ -1005,9 +1005,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