]> OCCT Git - occt-copy.git/commitdiff
0029430: [Regression] Curve evaluation at boundary point.
authornbv <nbv@opencascade.com>
Tue, 16 Jan 2018 13:03:01 +0000 (16:03 +0300)
committeremv <emv@opencascade.com>
Wed, 7 Aug 2019 05:26:55 +0000 (08:26 +0300)
Before the fix, BRepAdaptor_CompCurve considered the input wire to be periodic with period LastParameter()-FirstParameter().
Now, method IsPeriodic will always return FALSE because it is impossible to obtain correspondence between the members of BRepAdaptor_CompCurve class and its periodicity status.
New behavior has been documented in upgrade-guide.

dox/dev_guides/upgrade/upgrade.md
src/BRepAdaptor/BRepAdaptor_CompCurve.cxx
src/BRepAdaptor/BRepAdaptor_CompCurve.hxx
src/BRepFill/BRepFill_PipeShell.cxx
src/QABugs/QABugs_20.cxx
tests/bugs/modalg_7/bug29430 [new file with mode: 0644]

index 9593116d3a1f8933d59d6a149820761b2b741c87..d91c5234023d121cc85a6cd023fb5d97bc7f3e71 100644 (file)
@@ -1437,3 +1437,10 @@ The Error/Warning reporting system of the algorithms in Boolean Component (in al
 The methods returning the status of errors and warnings of the algorithms (ErrorStatus() and WarningStatus()) have been removed.
 Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
 The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().
+
+@section upgrade_occt730 Upgrade to OCCT 7.3.0
+
+@subsection upgrade_730_BRepAdaptor_CompCurve Changes in BRepAdaptor_CompCurve
+
+The method BRepAdaptor_CompCurve::SetPeriodic has been eliminated.
+Since new version, the method BRepAdaptor_CompCurve::IsPeriodic() will always return FALSE. Earlier, it could return TRUE in case if the wire contained only one edge based on periodic curve. 
index bb72836bdafca14be0582f0cea6c4bba3c071d94..e4068ac95c6912fbd4baee905e6879fe8faea9d1 100644 (file)
@@ -46,11 +46,9 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve()
 : TFirst  (0.0),
   TLast   (0.0),
   PTol    (0.0),
-  myPeriod(0.0),
   CurIndex(-1),
   Forward (Standard_False),
-  IsbyAC  (Standard_False),
-  Periodic(Standard_False)
+  IsbyAC  (Standard_False)
 {
 }
 
@@ -60,11 +58,9 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire&     theWire,
   TFirst  (0.0),
   TLast   (0.0),
   PTol    (0.0),
-  myPeriod(0.0),
   CurIndex(-1),
   Forward (Standard_False),
-  IsbyAC  (theIsAC),
-  Periodic(Standard_False)
+  IsbyAC  (theIsAC)
 {
   Initialize(theWire, theIsAC);
 }
@@ -78,11 +74,9 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
   TFirst  (theFirst),
   TLast   (theLast),
   PTol    (theTolerance),
-  myPeriod(0.0),
   CurIndex(-1),
   Forward (Standard_False),
-  IsbyAC  (theIsAC),
-  Periodic(Standard_False)
+  IsbyAC  (theIsAC)
 {
   Initialize(theWire, theIsAC, theFirst, theLast, theTolerance);
 }
@@ -144,13 +138,6 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
 
   TFirst = 0;
   TLast = myKnots->Value(myKnots->Length());
-  myPeriod = TLast - TFirst;
-  if (NbEdge == 1)  {
-    Periodic =  myCurves->Value(1).IsPeriodic();
-  }
-  else {
-    Periodic = Standard_False;
-  }
 }
 
  void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W,
@@ -200,15 +187,6 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
   }
 }
 
-
-void BRepAdaptor_CompCurve::SetPeriodic(const Standard_Boolean isPeriodic)
-{
-  if (myWire.Closed()) {
-    Periodic = isPeriodic;
-  }
-}
-
-
 const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
 {
   return myWire;
@@ -308,13 +286,13 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
 
  Standard_Boolean BRepAdaptor_CompCurve::IsPeriodic() const
 {
-  return Periodic;
+  return Standard_False;
 
 }
 
  Standard_Real BRepAdaptor_CompCurve::Period() const
 {
-  return myPeriod;
+  return (TLast - TFirst);
 }
 
  gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
@@ -475,12 +453,6 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
 
 
   Wtest = W+Eps; //Offset to discriminate the nodes
-  if(Periodic){
-    Wtest = ElCLib::InPeriod(Wtest,
-                            0,
-                            myPeriod);
-    W = Wtest-Eps;
-  }
 
   // Find the index
   Standard_Boolean Trouve = Standard_False;
index 5de39ef909c3ffae2cb0f8fee93d2075f9f0c5b4..ca46e6e36b413926e4a064a1716f893cebc931b0 100644 (file)
@@ -53,6 +53,9 @@ class Geom_BSplineCurve;
 //! of the BRep topology like a 3D curve.
 //! Warning: With this  class of curve,  C0 and C1 continuities
 //! are not assumed. So be carful with some algorithm!
+//! Please note that BRepAdaptor_CompCurve cannot be
+//! periodic curve at all (even if it contains single 
+//! periodic edge).
 class BRepAdaptor_CompCurve  : public Adaptor3d_Curve
 {
 public:
@@ -75,10 +78,6 @@ public:
   //! Sets wire <W> and trimmed  parameter.
   Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
   
-  //! Set the flag Periodic.
-  //! Warning: This method has no effect if the wire is not closed
-  Standard_EXPORT void SetPeriodic (const Standard_Boolean Periodic);
-  
   //! Returns the wire.
   Standard_EXPORT const TopoDS_Wire& Wire() const;
   
@@ -197,15 +196,11 @@ private:
   Standard_Real TFirst;
   Standard_Real TLast;
   Standard_Real PTol;
-  Standard_Real myPeriod;
   Handle(BRepAdaptor_HArray1OfCurve) myCurves;
   Handle(TColStd_HArray1OfReal) myKnots;
   Standard_Integer CurIndex;
   Standard_Boolean Forward;
   Standard_Boolean IsbyAC;
-  Standard_Boolean Periodic;
-
-
 };
 
 
index 519c6b5d0b19deb5002833ce741edf19d4379d2f..b381330f666d90ae5378f195810eed7cbbe6135d 100644 (file)
@@ -385,10 +385,8 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
   if (Affich)
     DBRep::Set("theguide", TheGuide);
 #endif
-  // transform the guide in a single curve (periodic if posssible)
-  Handle(BRepAdaptor_HCompCurve) Guide  = 
-    new (BRepAdaptor_HCompCurve) (TheGuide);
-  Guide->ChangeCurve().SetPeriodic(Standard_True);
+  // transform the guide in a single curve
+  Handle(BRepAdaptor_HCompCurve) Guide = new (BRepAdaptor_HCompCurve) (TheGuide);
 
   if (CurvilinearEquivalence) { // trihedron by curvilinear reduced abscissa
     if (KeepContact == BRepFill_Contact ||
index 53d6c51c281c503f38c2338dc50b07be8e10c0cd..afc445383a1dd9f5a43678f8de31d3a8f77828ba 100644 (file)
@@ -2579,6 +2579,39 @@ static Standard_Integer OCC30708_2 (Draw_Interpretor& di, Standard_Integer, cons
   return 0;
 }
 
+#include <GC_MakeArcOfCircle.hxx>
+#include <BRepAdaptor_CompCurve.hxx>
+#include <gp_Circ.hxx>
+//=======================================================================
+//function : OCC29430
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC29430(Draw_Interpretor& theDI,
+                                 Standard_Integer /*theNArg*/,
+                                 const char** theArgVal)
+{
+  const Standard_Real r45 = M_PI / 4.0, r225 = 3.0*M_PI / 4.0;
+
+  GC_MakeArcOfCircle arcMaker(gp_Circ(gp_Ax2(gp_Pnt(0.0, 0.0, 0.0), gp_Dir(0.0, 0.0, 1.0), gp_Dir(1.0, 0.0, 0.0)), 1.0), r45, r225, Standard_True);
+  BRepBuilderAPI_MakeEdge edgeMaker(arcMaker.Value());
+  BRepBuilderAPI_MakeWire wireMaker(edgeMaker.Edge());
+  const TopoDS_Wire circle = wireMaker.Wire();
+
+  DBRep::Set(theArgVal[1], circle);
+
+  BRepAdaptor_CompCurve curve(circle);
+  theDI << "Curve.FirstParameter() = " << curve.FirstParameter() << "\n";
+  theDI << "Curve.LastParameter() = " << curve.LastParameter() << "\n";
+  theDI << "Curve.Period() = " << (curve.IsPeriodic()? curve.Period() : 0.0) << "\n";
+  const gp_Pnt aStartPt = curve.Value(curve.FirstParameter());
+  const gp_Pnt anEndPt = curve.Value(curve.LastParameter());
+
+  DrawTrSurf::Set(theArgVal[2], aStartPt);
+  DrawTrSurf::Set(theArgVal[3], anEndPt);
+
+  return 0;
+}
+
 void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   const char *group = "QABugs";
 
@@ -2614,5 +2647,9 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC30708_2", "Tests initialization of the BRepLib_MakeWire with null shape",
                    __FILE__, OCC30708_2, group);
 
+  theCommands.Add("OCC29430", "OCC29430 <result wire> "
+                              "<result first point> <result last point>",
+                              __FILE__, OCC29430, group);
+
   return;
 }
diff --git a/tests/bugs/modalg_7/bug29430 b/tests/bugs/modalg_7/bug29430
new file mode 100644 (file)
index 0000000..b29c40f
--- /dev/null
@@ -0,0 +1,46 @@
+puts "========"
+puts "OCC29430"
+puts "========"
+puts ""
+#################################################
+# [Regression] Curve evaluation at boundary point.
+#################################################
+
+pload QAcommands
+
+# After launching the command below we will obtain
+# some wire (stored in "result" variable) containing
+# a single edge based on arc of circle and its first and last
+# 3D-points (p1 and p2 correspondingly) taken from
+# composite curve (BRepAdaptor_CompCurve) built on this wire. 
+
+OCC29430 result p1 p2
+
+vertex v1 p1
+vertex v2 p2
+
+explode result v
+
+# Now, let's check 
+# 1. whether p1 and p2 match the vertices of the wire;
+# 2. whether p1 and p2 are different points.
+
+distmini d11 result_1 v1
+distmini d12 result_1 v2
+distmini d21 result_2 v1
+distmini d22 result_2 v2
+distmini dv12 v1 v2
+
+
+if { ([dval d11_val] > 1.0e-7) && ([dval d21_val] > 1.0e-7) } {
+  puts "Error: Start point of the wire does not match any its vertex."
+}
+if { ([dval d12_val] > 1.0e-7) && ([dval d22_val] > 1.0e-7) } { 
+  puts "Error: End point of the wire does not match any its vertex."
+}
+
+if { [dval dv12_val] < 1.0e-7 } { 
+  puts "Error: Start and End points of the wire are the same."
+}
+
+