]> OCCT Git - occt.git/commitdiff
0026269: Modeling Data - Analytical extrema does not take into account trimmed input...
authorifv <ifv@opencascade.com>
Fri, 6 Aug 2021 11:49:14 +0000 (14:49 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 3 Sep 2021 17:19:56 +0000 (20:19 +0300)
Treatment of trimmed data is added
Extrema/Extrema_ExtCC.cxx

Test cases added
tests/lowalgos/extcc/bug26269_1
tests/lowalgos/extcc/bug26269_2

Test cases are modified according to new behavior of algorithm

14 files changed:
src/Extrema/Extrema_ExtCC.cxx
src/Extrema/Extrema_ExtCC.hxx
tests/lowalgos/extcc/bug26269_1 [new file with mode: 0644]
tests/lowalgos/extcc/bug26269_2 [new file with mode: 0644]
tests/lowalgos/extcc/bug29712_13
tests/lowalgos/extcc/bug29712_21
tests/lowalgos/extcc/bug29712_22
tests/lowalgos/extcc/bug29712_24
tests/lowalgos/extcc/bug29712_25
tests/lowalgos/extcc/bug29712_29
tests/lowalgos/extcc/bug29712_3
tests/lowalgos/extcc/bug29712_32
tests/lowalgos/extcc/bug29712_37
tests/lowalgos/extcc/bug29712_5

index fa77b80c79a142341e1d71554066d365dd7d3a7e..e3bfe4a60ed594df7ff15e43218e186e0385477e 100644 (file)
@@ -56,7 +56,7 @@ Extrema_ExtCC::Extrema_ExtCC (const Standard_Real TolC1,
                               const Standard_Real TolC2)
 : myIsFindSingleSolution(Standard_False),
   myDone (Standard_False),
-  myIsPar(Standard_False)
+  myIsParallel(Standard_False)
 {
   myC[0] = 0; myC[1] = 0;
   myInf[0] = myInf[1] = -Precision::Infinite();
@@ -217,7 +217,7 @@ void Extrema_ExtCC::Perform()
   myDone = Standard_False;
   mypoints.Clear();
   mySqDist.Clear();
-  myIsPar = Standard_False;
+  myIsParallel = Standard_False;
 
   GeomAbs_CurveType type1 = myC[0]->GetType();
   GeomAbs_CurveType type2 = myC[1]->GetType();
@@ -228,20 +228,20 @@ void Extrema_ExtCC::Perform()
   U21 = myInf[1];
   U22 = mySup[1];
 
-  if (!Precision::IsInfinite(U11)) P1f = Extrema_CurveTool::Value(*myC[0], U11);
-  if (!Precision::IsInfinite(U12)) P1l = Extrema_CurveTool::Value(*myC[0], U12);
-  if (!Precision::IsInfinite(U21)) P2f = Extrema_CurveTool::Value(*myC[1], U21);
-  if (!Precision::IsInfinite(U22)) P2l = Extrema_CurveTool::Value(*myC[1], U22);
+  if (!Precision::IsInfinite(U11)) myP1f = Extrema_CurveTool::Value(*myC[0], U11);
+  if (!Precision::IsInfinite(U12)) myP1l = Extrema_CurveTool::Value(*myC[0], U12);
+  if (!Precision::IsInfinite(U21)) myP2f = Extrema_CurveTool::Value(*myC[1], U21);
+  if (!Precision::IsInfinite(U22)) myP2l = Extrema_CurveTool::Value(*myC[1], U22);
   
 
   if (Precision::IsInfinite(U11) || Precision::IsInfinite(U21)) mydist11 = RealLast();
-  else mydist11 = P1f.SquareDistance(P2f);
+  else mydist11 = myP1f.SquareDistance(myP2f);
   if (Precision::IsInfinite(U11) || Precision::IsInfinite(U22)) mydist12 = RealLast();
-  else mydist12 = P1f.SquareDistance(P2l);
+  else mydist12 = myP1f.SquareDistance(myP2l);
   if (Precision::IsInfinite(U12) || Precision::IsInfinite(U21)) mydist21 = RealLast();
-  else mydist21 = P1l.SquareDistance(P2f);
+  else mydist21 = myP1l.SquareDistance(myP2f);
   if (Precision::IsInfinite(U12) || Precision::IsInfinite(U22)) mydist22 = RealLast();
-  else mydist22 = P1l.SquareDistance(P2l);
+  else mydist22 = myP1l.SquareDistance(myP2l);
 
   //Depending on the types of curves, the algorithm is chosen:
   //- _ExtElC, when one of the curves is a line and the other is elementary,
@@ -329,7 +329,7 @@ Standard_Boolean Extrema_ExtCC::IsParallel() const
     throw StdFail_NotDone();
   }
 
-  return myIsPar;
+  return myIsParallel;
 }
 
 
@@ -395,10 +395,10 @@ void Extrema_ExtCC::TrimmedSquareDistances(Standard_Real& dist11,
   dist12 = mydist12;
   dist21 = mydist21;
   dist22 = mydist22;
-  P11 = P1f;
-  P12 = P1l;
-  P21 = P2f;
-  P22 = P2l;
+  P11 = myP1f;
+  P12 = myP1l;
+  P21 = myP2f;
+  P22 = myP2l;
 }
 
 //=======================================================================
@@ -411,7 +411,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
                                           const Standard_Real theUt22,
                                           const Standard_Real theSqDist)
 {
-  if (!myIsPar)
+  if (!myIsParallel)
     return;
 
   const GeomAbs_CurveType aType1 = Extrema_CurveTool::GetType (*myC[0]);
@@ -421,7 +421,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
   {
     mySqDist.Append(theSqDist);
     myDone = Standard_True;
-    myIsPar = Standard_True;
+    myIsParallel = Standard_True;
     return;
   }
   
@@ -446,7 +446,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
     }
     else
     {
-      myIsPar = Standard_False;
+      myIsParallel = Standard_False;
     }
 
     return;
@@ -473,7 +473,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
       // to the 2nd one must intersect the (native) trimmed range of
       // the 2nd line.
 
-      myIsPar = Standard_False;
+      myIsParallel = Standard_False;
 
       const gp_Lin aLin1 = myC[0]->Line();
       const gp_Lin aLin2 = myC[1]->Line();
@@ -515,7 +515,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
       {
         ClearSolutions();
         mySqDist.Append(theSqDist);
-        myIsPar = Standard_True;
+        myIsParallel = Standard_True;
       }
       else if (!aRange2.IsVoid())
       {
@@ -539,12 +539,59 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
         mypoints.Append(aP2);
         mySqDist.Append(theSqDist);
       }
-    }
+      else
+      {
+        //Case like this:
+
+        //  **************     aLin1
+        //                 o
+        //                  o
+        //                   ***********  aLin2
+        // 
+        //Take minimal trimmed distance
+        Standard_Real aDmin, aDists[4] = {mydist11, mydist12, mydist21, mydist22};
+        Extrema_POnCurv aP1, aP2;
+        aDmin = aDists[0];
+        Standard_Integer i, imin = 0;
+        for (i = 1; i < 4; ++i)
+        {
+          if (aDmin > aDists[i])
+          {
+            aDmin = aDists[i];
+            imin = i;
+          }
+        }
+        if (imin == 0)
+        {
+          aP1.SetValues(myInf[0], myP1f);
+          aP2.SetValues(myInf[1], myP2f);
+        }
+        else if (imin == 1)
+        {
+          aP1.SetValues(myInf[0], myP1f);
+          aP2.SetValues(mySup[1], myP2l);
+        }
+        else if (imin == 2)
+        {
+          aP1.SetValues(mySup[0], myP1l);
+          aP2.SetValues(myInf[1], myP2f);
+        }
+        else 
+        {
+          aP1.SetValues(mySup[0], myP1l);
+          aP2.SetValues(mySup[1], myP2l);
+        }
+        ClearSolutions();
+        mypoints.Append(aP1);
+        mypoints.Append(aP2);
+        mySqDist.Append(aDmin);
+      }
+    }   
   }
   else
   {
     // Circle - Circle
-    myIsPar = Standard_False;
+    myIsParallel = Standard_False;
 
     //Two arcs with ranges [U1, U2] and [V1, V2] correspondingly are
     //considered to be parallel in the following case:
@@ -614,14 +661,14 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
       //Cases are possible and processed below:
       //1. Extrema does not exist. In this case all common ranges are VOID.
       //2. Arcs are parallel and distance between them is equal to sqrt(theSqDist).
-      //    In this case myIsPar = TRUE definitely.
+      //    In this case myIsParallel = TRUE definitely.
       //3. Arcs are parallel and distance between them is equal to (sqrt(theSqDist) + R),
-      //    where R is the least radius of the both circles. In this case myIsPar flag
+      //    where R is the least radius of the both circles. In this case myIsParallel flag
       //    will temporary be set to TRUE but check will be continued until less
       //    distance will be found. At that, region with the least distance can be
-      //    either a local point or continuous range. In 1st case myIsPar = FALSE and
+      //    either a local point or continuous range. In 1st case myIsParallel = FALSE and
       //    several (or single) extremas will be returned. In the 2nd one
-      //    myIsPar = TRUE and only the least distance will be returned.
+      //    myIsParallel = TRUE and only the least distance will be returned.
       //4. Arcs are not parallel. Then several (or single) extremas will be returned.
 
       if (aRng.Delta() > Precision::Angular())
@@ -639,11 +686,11 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
           aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
         }
 
-        if (aMinSqD <= aMinSquareDist)
+        if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
         {
           ClearSolutions();
           mySqDist.Append(aMinSqD);
-          myIsPar = Standard_True;
+          myIsParallel = Standard_True;
 
           const Standard_Real aDeltaSqDist = aMinSqD - theSqDist;
           const Standard_Real aSqD = Max(aMinSqD, theSqDist);
@@ -685,13 +732,13 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
                                 Extrema_CurveTool::Circle (*myC[0]),
                                 Precision::Confusion(), theUt11, theUt12);
 
-        Standard_Boolean isFound = !myIsPar;
+        Standard_Boolean isFound = !myIsParallel;
 
         if (!isFound)
         {
-          //If the flag myIsPar was set earlier then it does not mean that
+          //If the flag myIsParallel was set earlier then it does not mean that
           //we have found the minimal distance. Here we check it. If there is
-          //a pair of points, which are in less distance then myIsPar flag
+          //a pair of points, which are in less distance then myIsParallel flag
           //was unset and the algorithm will return these nearest points.
 
           for (Standard_Integer anExtID = 1; anExtID <= ExtPCir.NbExt(); anExtID++)
@@ -707,7 +754,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
         if (isFound)
         {
           ClearSolutions();
-          myIsPar = Standard_False;
+          myIsParallel = Standard_False;
           for (Standard_Integer anExtID = 1; anExtID <= ExtPCir.NbExt(); anExtID++)
           {
             mypoints.Append(ExtPCir.Point(anExtID));
@@ -717,7 +764,58 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
           }
         }
       }
+      else
+      {
+        //Case like this:
 
+        //  **************     Cir1
+        //                 o
+        //                  o
+        //                   ***********  Cir2
+        // 
+        //Take minimal trimmed distance
+        myIsParallel = Standard_False;
+        Standard_Real aDmin, aDists[4] = { mydist11, mydist12, mydist21, mydist22 };
+        Extrema_POnCurv aP1, aP2;
+        aDmin = aDists[0];
+        Standard_Integer k, imin = 0;
+        for (k = 1; k < 4; ++k)
+        {
+          if (aDmin > aDists[k])
+          {
+            aDmin = aDists[k];
+            imin = k;
+          }
+        }
+        if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
+        {
+          if (imin == 0)
+          {
+            aP1.SetValues(myInf[0], myP1f);
+            aP2.SetValues(myInf[1], myP2f);
+          }
+          else if (imin == 1)
+          {
+            aP1.SetValues(myInf[0], myP1f);
+            aP2.SetValues(mySup[1], myP2l);
+          }
+          else if (imin == 2)
+          {
+            aP1.SetValues(mySup[0], myP1l);
+            aP2.SetValues(myInf[1], myP2f);
+          }
+          else
+          {
+            aP1.SetValues(mySup[0], myP1l);
+            aP2.SetValues(mySup[1], myP2l);
+          }
+          ClearSolutions();
+          mypoints.Append(aP1);
+          mypoints.Append(aP2);
+          mySqDist.Append(aDmin);
+          aMinSquareDist = Min(aMinSquareDist, aDmin);
+        }
+      }
       aProjRng1.Shift(M_PI);
     }
   }
@@ -741,8 +839,8 @@ void Extrema_ExtCC::PrepareResults(const Extrema_ExtElC&  AlgExt,
 
   myDone = AlgExt.IsDone();
   if (myDone) {
-    myIsPar = AlgExt.IsParallel();
-    if (myIsPar) {
+    myIsParallel = AlgExt.IsParallel();
+    if (myIsParallel) {
       PrepareParallelResult(Ut11, Ut12, Ut21, Ut22, AlgExt.SquareDistance());
     }
     else {
@@ -814,8 +912,8 @@ void Extrema_ExtCC::PrepareResults(const Extrema_ECC&   AlgExt,
   myDone = AlgExt.IsDone();
   if (myDone)
   {
-    myIsPar = AlgExt.IsParallel();
-    if (myIsPar)
+    myIsParallel = AlgExt.IsParallel();
+    if (myIsParallel)
     {
       PrepareParallelResult(Ut11, Ut12, Ut21, Ut22, AlgExt.SquareDistance());
     }
index f3a41288ff1e5854ab0d799591ab61a77d9b9515..0a8ff0228af3f41b70e7e6ed998671ee04ad1e58 100644 (file)
@@ -46,13 +46,24 @@ public:
   DEFINE_STANDARD_ALLOC
 
   
-  Standard_EXPORT Extrema_ExtCC(const Standard_Real TolC1 = 1.0e-10, const Standard_Real TolC2 = 1.0e-10);
+  Standard_EXPORT Extrema_ExtCC(const Standard_Real TolC1 = 1.0e-10,
+                                const Standard_Real TolC2 = 1.0e-10);
   
   //! It calculates all the distances.
-  Standard_EXPORT Extrema_ExtCC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2, const Standard_Real TolC1 = 1.0e-10, const Standard_Real TolC2 = 1.0e-10);
+  Standard_EXPORT Extrema_ExtCC(const Adaptor3d_Curve& C1,
+                                const Adaptor3d_Curve& C2,
+                                const Standard_Real TolC1 = 1.0e-10,
+                                const Standard_Real TolC2 = 1.0e-10);
   
   //! It calculates all the distances.
-  Standard_EXPORT Extrema_ExtCC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Real TolC1 = 1.0e-10, const Standard_Real TolC2 = 1.0e-10);
+  Standard_EXPORT Extrema_ExtCC(const Adaptor3d_Curve& C1,
+                                const Adaptor3d_Curve& C2,
+                                const Standard_Real U1,
+                                const Standard_Real U2,
+                                const Standard_Real V1,
+                                const Standard_Real V2,
+                                const Standard_Real TolC1 = 1.0e-10,
+                                const Standard_Real TolC2 = 1.0e-10);
 
   //! Initializes but does not perform algorithm.
   Standard_EXPORT void Initialize (const Adaptor3d_Curve& C1,
@@ -72,9 +83,14 @@ public:
   
   Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C);
   
-  Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C, const Standard_Real Uinf, const Standard_Real Usup);
+  Standard_EXPORT void SetCurve (const Standard_Integer theRank,
+                                 const Adaptor3d_Curve& C,
+                                 const Standard_Real Uinf,
+                                 const Standard_Real Usup);
   
-  Standard_EXPORT void SetRange (const Standard_Integer theRank, const Standard_Real Uinf, const Standard_Real Usup);
+  Standard_EXPORT void SetRange (const Standard_Integer theRank,
+                                 const Standard_Real Uinf,
+                                 const Standard_Real Usup);
   
   Standard_EXPORT void SetTolerance (const Standard_Integer theRank, const Standard_Real Tol);
   
@@ -94,13 +110,22 @@ public:
   
   //! Returns the points of the Nth extremum distance.
   //! P1 is on the first curve, P2 on the second one.
-  Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv& P1, Extrema_POnCurv& P2) const;
+  Standard_EXPORT void Points (const Standard_Integer N,
+                               Extrema_POnCurv& P1,
+                               Extrema_POnCurv& P2) const;
   
   //! if the curve is a trimmed curve,
   //! dist11 is a square distance between the point on C1
   //! of parameter FirstParameter and the point of
   //! parameter FirstParameter on C2.
-  Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dist11, Standard_Real& distP12, Standard_Real& distP21, Standard_Real& distP22, gp_Pnt& P11, gp_Pnt& P12, gp_Pnt& P21, gp_Pnt& P22) const;
+  Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dist11,
+                                               Standard_Real& distP12,
+                                               Standard_Real& distP21,
+                                               Standard_Real& distP22,
+                                               gp_Pnt& P11,
+                                               gp_Pnt& P12,
+                                               gp_Pnt& P21,
+                                               gp_Pnt& P22) const;
 
   //! Set flag for single extrema computation. Works on parametric solver only.
   Standard_EXPORT void SetSingleSolutionFlag (const Standard_Boolean theSingleSolutionFlag);
@@ -151,17 +176,17 @@ private:
   Standard_Boolean myIsFindSingleSolution; // Default value is false.
   Extrema_ECC myECC;
   Standard_Boolean myDone;
-  Standard_Boolean myIsPar;
+  Standard_Boolean myIsParallel;
   Extrema_SequenceOfPOnCurv mypoints;
   TColStd_SequenceOfReal mySqDist;
   const Adaptor3d_Curve* myC[2];
   Standard_Real myInf[2];
   Standard_Real mySup[2];
   Standard_Real myTol[2];
-  gp_Pnt P1f;
-  gp_Pnt P1l;
-  gp_Pnt P2f;
-  gp_Pnt P2l;
+  gp_Pnt myP1f;
+  gp_Pnt myP1l;
+  gp_Pnt myP2f;
+  gp_Pnt myP2l;
   Standard_Real mydist11;
   Standard_Real mydist12;
   Standard_Real mydist21;
diff --git a/tests/lowalgos/extcc/bug26269_1 b/tests/lowalgos/extcc/bug26269_1
new file mode 100644 (file)
index 0000000..a07c5f6
--- /dev/null
@@ -0,0 +1,24 @@
+puts "========"
+puts "0026269: Modeling Data - Analytical extrema does not take into account trimmed input data"
+puts "========"
+puts ""
+
+#case 1
+line l1 0 0 0 1 0 0
+line l2 2 2 0 1 0 0
+trim l1 l1 0 1
+trim l2 l2 0 1
+
+set res_extrema [extrema l1 l2]
+
+if { [regexp "Infinite number of extremas" $res_extrema] == 0} {
+  if {[llength $res_extrema] != 1} {
+    puts "Error : expected 1 extrema, but found [llength $res_extrema]"
+  }
+} else {
+  puts "Error : Infinite number of extremas is found"
+}
+
+smallview  +X+Y
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/lowalgos/extcc/bug26269_2 b/tests/lowalgos/extcc/bug26269_2
new file mode 100644 (file)
index 0000000..0726fd2
--- /dev/null
@@ -0,0 +1,24 @@
+puts "========"
+puts "0026269: Modeling Data - Analytical extrema does not take into account trimmed input data"
+puts "========"
+puts ""
+
+#case 2
+circle c1 0 0 0 10
+circle c2 0 0 0 5
+trim c1 c1 0 1
+trim c2 c2 3 4
+
+set res_extrema [extrema c1 c2]
+
+if { [regexp "Infinite number of extremas" $res_extrema] == 0} {
+  if {[llength $res_extrema] != 1} {
+    puts "Error : expected 1 extrema, but found [llength $res_extrema]"
+  }
+} else {
+  puts "Error : Infinite number of extremas is found"
+}
+
+smallview  +X+Y
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
index 36dc300487f5e73864101019a6566ae68788726f..3e54f3fd6564e975a5fd1bd35c83ce10b7d8cc2a 100644 (file)
@@ -17,8 +17,19 @@ circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 4 6
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index f2a1b419fee727f6697ca4bf0861265f087aef1d..569a0687c42f9de14f886bd42e11909d68c301b4 100644 (file)
@@ -17,8 +17,19 @@ circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 -3.2 -1.2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
\ No newline at end of file
index 9287c1f237517cf8cf98abf71efb6eed21432eab..b9e5d0733332ff777fb5d1a510dc6deb31359d30 100644 (file)
@@ -10,15 +10,24 @@ puts ""
 # However, they are bounded (trimmed) curves
 # and are shifted relatively to each other.
 
-set ExpDist 150.0
-
 circle c1 0 0 0 0 0 1 100
 circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 -3.1 -1.1
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index 280f73a4edf0d524c3e779800c1eba603c4cace3..7c0e22d63f9286d210f6f8820ec0007a72b2744f 100644 (file)
@@ -10,15 +10,25 @@ puts ""
 # However, they are bounded (trimmed) curves
 # and are shifted relatively to each other.
 
-set ExpDist 150.0
 
 circle c1 0 0 0 0 0 1 100
 circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 -9.5 -7.5
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index c8bd0973ba01aa3aa120d4d31d46d93ca5282e7e..1503119687c535ad4a56f854b78d145bbc3247a9 100644 (file)
@@ -17,8 +17,19 @@ circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 -8.3 -6.3
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index 0339082b9bbb309b65cecd40164f4dfe6e22b50a..eeb9d4efa3d27cb160cb030ca4fb94bedf446f13 100644 (file)
@@ -10,15 +10,25 @@ puts ""
 # However, they are bounded (trimmed) curves
 # and are shifted relatively to each other.
 
-set ExpDist 150.0
 
 circle c1 0 0 0 0 0 1 100
 circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 3
 trim c2 c2 3.1 5.1
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index e5424faea652f8cf8aaae60cebc7ae4f04c42faa..e9963706459dd2c523ca522410336ad1dbd8fb2c 100644 (file)
@@ -17,9 +17,19 @@ line c2 3 4 0 1 0 0
 trim c1 c1 0 1
 trim c2 c2 0 1
 
-if { ![regexp {No solutions!} [extrema c1 c2] ] } {
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
   puts "Error in Extrema-algorithm"
 } else {
   puts "Extrema-algorithm works properly"
 }
 
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index bd554f50357231a558fc6d1397c92ad66b1ead6d..53a41faeb9748ed0746e2f2e054b6ba5f5c6b7df 100644 (file)
@@ -17,8 +17,19 @@ circle c2 0 0 0 0 0 1 50
 trim c1 c1 0 pi
 trim c2 c2 -9.4 -7.4
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
index ab063504aa14d6eb7f407d13fe46f7d230332ff4..f9efb649811ce76545284e84c4a574d5b9567c36 100644 (file)
@@ -18,8 +18,20 @@ circle c2 0 0 0 0 0 1 50
 trim c1 c1 3 6.5 
 trim c2 c2 4 6 
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+  puts "Error in Extrema-algorithm"
+} else {
+  puts "Extrema-algorithm works properly"
+}
 
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
index b5794fadc32f966a355d52daa4b0637b9690dfc3..c43d75dd96b4cf7c55f783873fe6458d44f0a75d 100644 (file)
@@ -16,14 +16,19 @@ line c2 5 0 0 0 0 1
 trim c1 c1 -1.0e100 5
 trim c2 c2 10 20
 
-if { ![regexp {No solutions!} [extrema c1 c2] ] } {
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
   puts "Error in Extrema-algorithm"
 } else {
   puts "Extrema-algorithm works properly"
 }
 
-if { ![regexp {No solutions!} [extrema c2 c1] ] } {
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
   puts "Error in Extrema-algorithm"
 } else {
   puts "Extrema-algorithm works properly"
-}
+}
\ No newline at end of file