0029694: Geom2dGcc_Circ2dTanCenGeo crash
authornbv <nbv@opencascade.com>
Tue, 22 May 2018 09:15:27 +0000 (12:15 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 14 Jun 2018 11:03:06 +0000 (14:03 +0300)
The reason of this issue is in incorrectly interpreted the generic class "TheExtPC" (eliminated after the fix 0024773) as Extrema_ExtPC2d. Correct interpretation must be "Extrema_EPCOfExtPC2d" class.

Now this problem has been fixed in the class Geom2dGcc_Circ2dTanCenGeo.

New testgrid "lowalgos 2dgcc" has been created.

16 files changed:
dox/user_guides/draw_test_harness/draw_test_harness.md
src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx
src/GeometryTest/GeometryTest_ConstraintCommands.cxx
tests/lowalgos/2dgcc/buc60607_1 [moved from tests/bugs/moddata_1/buc60607_1 with 77% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60607_2 [moved from tests/bugs/moddata_1/buc60607_2 with 85% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60607_3 [moved from tests/bugs/moddata_1/buc60607_3 with 84% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60607_4 [moved from tests/bugs/moddata_1/buc60607_4 with 83% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60618 [moved from tests/bugs/moddata_1/buc60618 with 89% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60622_1 [moved from tests/bugs/moddata_1/buc60622_1 with 86% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60622_2 [moved from tests/bugs/moddata_1/buc60622_2 with 85% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60622_3 [moved from tests/bugs/moddata_1/buc60622_3 with 87% similarity, mode: 0644]
tests/lowalgos/2dgcc/buc60941 [moved from tests/bugs/moddata_1/buc60941 with 92% similarity, mode: 0644]
tests/lowalgos/2dgcc/bug23866 [moved from tests/bugs/moddata_3/bug23866 with 86% similarity]
tests/lowalgos/2dgcc/bug29694 [new file with mode: 0644]
tests/lowalgos/2dgcc/doc001 [new file with mode: 0644]
tests/lowalgos/grids.list

index 587c562..ce6aee1 100644 (file)
@@ -5684,18 +5684,33 @@ projponf f pnt
 
 Syntax: 
 ~~~~~
-cirtang cname curve/point/radius curve/point/radius curve/point/radius 
+cirtang result [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...
 ~~~~~
 
-Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc. 
+Builds all circles satisfying the condition: 
+1. the circle must be tangent to every given curve;
+2. the circle must pass through every given point;
+3. the radius of the circle must be equal to the requested one. 
+
+Only following set of input data is supported: Curve-Curve-Curve, Curve-Curve-Point, Curve-Curve-Radius, Curve-Point-Point, Curve-Point-Radius, Point-Point-Point, Point-Point-Radius. The solutions will be stored in variables *result_1*, *result_2*, etc.
 
 **Example:** 
 ~~~~~
-# a point, a line and a radius. 2 solutions 
+# a point, a line and a radius. 2 solutions of type Curve-Point-Radius (C-P-R)
 point p 0 0 
-line 1 10 0 -1 1 
-cirtang c p 1 4 
-== c_1 c_2 
+line l 10 0 -1 1 
+cirtang c -p p -c l -r 4 
+== Solution of type C-P-R is: c_1 c_2
+~~~~~
+
+Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type).
+
+**Example:** 
+~~~~~
+point pp 1 1
+2dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1
+cirtang r -p pp -c cc 
+== Solution of type C-P is: r_1 r_2 
 ~~~~~
 
 @subsubsection occt_draw_6_10_2  lintan
index d7487d3..44d8700 100644 (file)
@@ -41,12 +41,13 @@ Geom2dGcc_Circ2dTanCenGeo (const Geom2dGcc_QCurve&  Qualified1,
 //========================================================================
 //   Initialisation des champs.                                          +
 //========================================================================
-
-  cirsol(1,2)    ,
-  qualifier1(1,2),
-  pnttg1sol(1,2) ,
-  par1sol(1,2)   ,
-  pararg1(1,2)   
+  WellDone(Standard_False),
+  NbrSol(0),
+  cirsol(1, 2),
+  qualifier1(1, 2),
+  pnttg1sol(1, 2),
+  par1sol(1, 2),
+  pararg1(1, 2)
 {
   Standard_Real Tol = Abs(Tolerance);
   TColgp_Array1OfPnt2d pTan(1,2);
@@ -60,23 +61,19 @@ Geom2dGcc_Circ2dTanCenGeo (const Geom2dGcc_QCurve&  Qualified1,
   gp_Dir2d dirx(1.0,0.0);
   Standard_Real thePar;
   Geom2dAdaptor_Curve curve = Qualified1.Qualified();
-  Extrema_ExtPC2d distmin(Pcenter,curve,Geom2dGcc_CurveTool::NbSamples(curve),
-    Geom2dGcc_CurveTool::EpsX(curve,Tol),Tol);
+  Extrema_ExtPC2d distmin(Pcenter, curve, Geom2dGcc_CurveTool::FirstParameter(curve),
+                          Geom2dGcc_CurveTool::LastParameter(curve), Tol);
   if (!distmin.IsDone() ) { throw Standard_Failure(); }
   Standard_Integer nbext = distmin.NbExt();
   if(nbext==0) { throw Standard_Failure(); }
   while (i<=nbext) {
     thePar = distmin.Point(i).Parameter();
-    if (distmin.SquareDistance(i)<theDist2(1) && 
-      thePar>=Geom2dGcc_CurveTool::FirstParameter(curve) && 
-      thePar <= Geom2dGcc_CurveTool::LastParameter(curve)) {
+    if (distmin.SquareDistance(i)<theDist2(1)) {
         theDist2(1) = distmin.SquareDistance(i);
         theParam(1) = thePar;
         pTan(1) = distmin.Point(i).Value();
     }
-    if (distmin.SquareDistance(i)>theDist2(2) && 
-      thePar>=Geom2dGcc_CurveTool::FirstParameter(curve) && 
-      thePar <= Geom2dGcc_CurveTool::LastParameter(curve)) {
+    if (distmin.SquareDistance(i)>theDist2(2)) {
         theDist2(2) = distmin.SquareDistance(i);
         theParam(2) = thePar;
         pTan(2) = distmin.Point(i).Value();
index 7dd9cca..de80e10 100644 (file)
@@ -83,8 +83,7 @@ static Standard_Integer solutions(Draw_Interpretor& di,
     for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) {
       Handle(Geom2d_Circle) C = new Geom2d_Circle(ct3.ThisSolution(i));
       Sprintf(solname,"%s_%d",name,i);
-      char* temp = solname; // pour portage WNT
-      DrawTrSurf::Set(temp,C);
+      DrawTrSurf::Set(solname, C);
       di << solname << " ";
     }
     return 0;
@@ -107,8 +106,7 @@ static Standard_Integer solutions(Draw_Interpretor& di,
     for (Standard_Integer i = 1 ; i <= ct3.NbSolutions() ; i++) {
       Handle(Geom2d_Circle) C = new Geom2d_Circle(ct3.ThisSolution(i));
       Sprintf(solname,"%s_%d",name,i);
-      char* temp = solname; // pour portage WNT
-      DrawTrSurf::Set(temp,C);
+      DrawTrSurf::Set(solname, C);
       di << solname << " ";
     }
     return 0;
@@ -120,260 +118,211 @@ static Standard_Integer solutions(Draw_Interpretor& di,
 }
 
 //=======================================================================
-//function : cirtang
+//function : solutions
 //purpose  : 
 //=======================================================================
-
-static Standard_Integer cirtang (Draw_Interpretor& di,Standard_Integer n, const char** a)
+static Standard_Integer solutions(Draw_Interpretor& theDI,
+                                  Geom2dGcc_Circ2dTanCen& theCt2,
+                                  const char* theName)
 {
-  if (n < 5) return 1;
-
-  Handle(Geom2d_Curve) C1 = DrawTrSurf::GetCurve2d(a[2]);
-  Handle(Geom2d_Curve) C2 = DrawTrSurf::GetCurve2d(a[3]);
-  Handle(Geom2d_Curve) C3 = DrawTrSurf::GetCurve2d(a[4]);
-  gp_Pnt2d P1,P2,P3;
-  Standard_Boolean ip1 = DrawTrSurf::GetPoint2d(a[2],P1);
-  Standard_Boolean ip2 = DrawTrSurf::GetPoint2d(a[3],P2);
-  Standard_Boolean ip3 = DrawTrSurf::GetPoint2d(a[4],P3);
-
-  Standard_Real tol = Precision::Confusion();
-  if (n > 5) tol = Draw::Atof(a[5]);
-
-
-  if (!C1.IsNull()) {
-    // C-...
-    if (!C2.IsNull()) {
-      // C-C-...
-      if (!C3.IsNull()) {
-        // C-C-C
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C1),
-          Geom2dGcc::Unqualified(C2),
-          Geom2dGcc::Unqualified(C3),
-          tol,0,0,0);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else if (ip3) {
-        // C-C-P
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C1),
-          Geom2dGcc::Unqualified(C2),
-          new Geom2d_CartesianPoint(P3),
-          tol,0,0);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else {
-        // C-C-R
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1),
-          Geom2dGcc::Unqualified(C2),
-          Draw::Atof(a[4]),tol);
-        return solutions(di,ct3,a[1]);
-      }
-    }
-    else if (ip2) {
-      // C-P-..
-      if (!C3.IsNull()) {
-        // C-P-C
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C1),
-          Geom2dGcc::Unqualified(C3),
-          new Geom2d_CartesianPoint(P2),
-          tol,0,0);
-        return solutions(di,ct3,a[1]);
-      }
+  char solname[200];
 
-      else if (ip3) {
-        // C-P-P
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C1),
-          new Geom2d_CartesianPoint(P2),
-          new Geom2d_CartesianPoint(P3),
-          tol,0);
-        return solutions(di,ct3,a[1]);
-      }
+  Draw_Color col = DrawTrSurf_CurveColor(Draw_Color(Draw_vert));
+  DrawTrSurf_CurveColor(col);
 
-      else {
-        // C-P-R
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1),
-          new Geom2d_CartesianPoint(P2),
-          Draw::Atof(a[4]),tol);
-        return solutions(di,ct3,a[1]);
-      }
+  if (theCt2.IsDone())
+  {
+    for (Standard_Integer i = 1; i <= theCt2.NbSolutions(); i++)
+    {
+      Handle(Geom2d_Circle) C = new Geom2d_Circle(theCt2.ThisSolution(i));
+      Sprintf(solname, "%s_%d", theName, i);
+      DrawTrSurf::Set(solname, C);
+      theDI << solname << " ";
     }
+    return 0;
+  }
+  else
+  {
+    theDI << "Circ2dTanCen Not done";
+    return 1;
+  }
+}
 
-    else {
-      // C-R-..
-      if (!C3.IsNull()) {
-        // C-R-C
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1),
-          Geom2dGcc::Unqualified(C3),
-          Draw::Atof(a[3]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else if (ip3) {
-        // C-R-P
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C1),
-          new Geom2d_CartesianPoint(P3),
-          Draw::Atof(a[3]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else {
-        // C-R-R
-        di << "Curve, radius, radius ???\n";
-        return 1;
-      }
-    }
+//=======================================================================
+//function : Cirtang
+//purpose  : 
+//=======================================================================
+static Standard_Integer Cirtang(Draw_Interpretor& theDI,
+                                Standard_Integer theNArgs,
+                                const char** theArgVals)
+{
+  if (theNArgs < 3)
+  {
+    theDI << "Use: " << theArgVals[0] << "result [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...\n";
+    return 1;
   }
 
-  else if (ip1) {
-    // P-...
-    if (!C2.IsNull()) {
-      // P-C-...
-      if (!C3.IsNull()) {
-        // P-C-C
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C2),
-          Geom2dGcc::Unqualified(C3),
-          new Geom2d_CartesianPoint(P1),
-          tol,0,0);
-        return solutions(di,ct3,a[1]);
-      }
+  Standard_Real aTol = Precision::Confusion();
+  Handle(Geom2d_Curve) aC[3];
+  gp_Pnt2d aP[3];
+  Standard_Real aRadius = -1.0;
 
-      else if (ip3) {
-        // P-C-P
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C2),
-          new Geom2d_CartesianPoint(P1),
-          new Geom2d_CartesianPoint(P3),
-          tol,0);
-        return solutions(di,ct3,a[1]);
-      }
+  Standard_Integer aNbCurves = 0, aNbPnts = 0;
 
-      else {
-        // P-C-R
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2),
-          new Geom2d_CartesianPoint(P1),
-          Draw::Atof(a[4]),tol);
-        return solutions(di,ct3,a[1]);
-      }
+  for (Standard_Integer anArgID = 2; anArgID < theNArgs; anArgID++)
+  {
+    if (theArgVals[anArgID][0] != '-')
+    {
+      theDI << "Cannot interpret the argument #" << anArgID << " (" << theArgVals[anArgID] << ")\n";
+      return 1;
     }
-    else if (ip2) {
-      // P-P-..
-      if (!C3.IsNull()) {
-        // P-P-C
-        Geom2dGcc_Circ2d3Tan ct3(Geom2dGcc::Unqualified(C3),
-          new Geom2d_CartesianPoint(P1),
-          new Geom2d_CartesianPoint(P2),
-          tol,0);
-        return solutions(di,ct3,a[1]);
+    else if (!strcmp(theArgVals[anArgID], "-c"))
+    {
+      if (aNbCurves >= 3)
+      {
+        theDI << "A lot of curves are given (not greater than 3 ones are expected)\n";
+        return 1;
       }
 
-      else if (ip3) {
-        // P-P-P
-        Geom2dGcc_Circ2d3Tan ct3(new Geom2d_CartesianPoint(P1),
-          new Geom2d_CartesianPoint(P2),
-          new Geom2d_CartesianPoint(P3),
-          tol);
-        return solutions(di,ct3,a[1]);
+      aC[aNbCurves] = DrawTrSurf::GetCurve2d(theArgVals[++anArgID]);
+      if (aC[aNbCurves].IsNull())
+      {
+        theDI << "Error: " << theArgVals[anArgID] << " is not a curve\n";
+        return 1;
       }
 
-      else {
-        // P-P-R
-        Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P1),
-          new Geom2d_CartesianPoint(P2),
-          Draw::Atof(a[4]),tol);
-        return solutions(di,ct3,a[1]);
-      }
+      aNbCurves++;
     }
-
-    else {
-      // P-R-..
-      if (!C3.IsNull()) {
-        // P-R-C
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C3),
-          new Geom2d_CartesianPoint(P1),
-          Draw::Atof(a[3]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else if (ip3) {
-        // P-R-P
-        Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P1),
-          new Geom2d_CartesianPoint(P3),
-          Draw::Atof(a[3]),
-          tol);
-        return solutions(di,ct3,a[1]);
+    else if (!strcmp(theArgVals[anArgID], "-p"))
+    {
+      if (aNbPnts >= 3)
+      {
+        theDI << "A lot of points are given (not greater than 3 ones are expected)\n";
+        return 1;
       }
 
-      else {
-        // P-R-R
-        di << "Point, radius, radius ???\n";
+      if (!DrawTrSurf::GetPoint2d(theArgVals[++anArgID], aP[aNbPnts]))
+      {
+        theDI << "Error: " << theArgVals[anArgID] << " is not a point\n";
         return 1;
       }
+
+      aNbPnts++;
+    }
+    else if (!strcmp(theArgVals[anArgID], "-r"))
+    {
+      aRadius = Draw::Atof(theArgVals[++anArgID]);
+    }
+    else if (!strcmp(theArgVals[anArgID], "-t"))
+    {
+      aTol = Draw::Atof(theArgVals[++anArgID]);
+    }
+    else
+    {
+      theDI << "Unknown option " << theArgVals[anArgID] << "\n";
+      return 1;
     }
   }
 
-  else {
-    // R-...
-    if (!C2.IsNull()) {
-      // R-C-...
-      if (!C3.IsNull()) {
-        // R-C-C
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2),
-          Geom2dGcc::Unqualified(C3),
-          Draw::Atof(a[2]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else if (ip3) {
-        // R-C-P
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C2),
-          new Geom2d_CartesianPoint(P3),
-          Draw::Atof(a[2]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
-
-      else {
-        // R-C-R
-        di << "Radius - Curve - Radius ??\n";
-        return 1;
-      }
+  if (aNbCurves == 3)
+  {
+    // C-C-C
+    Geom2dGcc_Circ2d3Tan aCt3(Geom2dGcc::Unqualified(aC[0]),
+                              Geom2dGcc::Unqualified(aC[1]),
+                              Geom2dGcc::Unqualified(aC[2]),
+                              aTol, 0, 0, 0);
+    theDI << "Solution of type C-C-C is: ";
+    return solutions(theDI, aCt3, theArgVals[1]);
+  }
+  else if (aNbCurves == 2)
+  {
+    if (aNbPnts >= 1)
+    {
+      // C-C-P
+      Geom2dGcc_Circ2d3Tan aCt3(Geom2dGcc::Unqualified(aC[0]),
+                                Geom2dGcc::Unqualified(aC[1]),
+                                new Geom2d_CartesianPoint(aP[0]),
+                                aTol, 0, 0);
+      theDI << "Solution of type C-C-P is: ";
+      return solutions(theDI, aCt3, theArgVals[1]);
+    }
+    else if (aRadius > 0)
+    {
+      // C-C-R
+      Geom2dGcc_Circ2d2TanRad aCt3(Geom2dGcc::Unqualified(aC[0]),
+                                   Geom2dGcc::Unqualified(aC[1]),
+                                   aRadius, aTol);
+      theDI << "Solution of type C-C-R is: ";
+      return solutions(theDI, aCt3, theArgVals[1]);
     }
-    else if (ip2) {
-      // R-P-..
-      if (!C3.IsNull()) {
-        // R-P-C
-        Geom2dGcc_Circ2d2TanRad ct3(Geom2dGcc::Unqualified(C3),
-          new Geom2d_CartesianPoint(P2),
-          Draw::Atof(a[2]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }
 
-      else if (ip3) 
+    theDI << "Error: Unsupported set of input data!\n";
+    return 1;
+  }
+  else if (aNbCurves == 1)
+  {
+    if (aNbPnts == 2)
+    {
+      //C-P-P
+      Geom2dGcc_Circ2d3Tan aCt3(Geom2dGcc::Unqualified(aC[0]),
+                                new Geom2d_CartesianPoint(aP[0]),
+                                new Geom2d_CartesianPoint(aP[1]),
+                                aTol,0);
+      theDI << "Solution of type C-P-P is: ";
+      return solutions(theDI, aCt3, theArgVals[1]);
+    }
+    else if (aNbPnts == 1)
+    {
+      if (aRadius > 0.0)
       {
-        // R-P-P
-        Geom2dGcc_Circ2d2TanRad ct3(new Geom2d_CartesianPoint(P2),
-          new Geom2d_CartesianPoint(P3),
-          Draw::Atof(a[2]),
-          tol);
-        return solutions(di,ct3,a[1]);
-      }      
-      else {
-        // R-P-R
-        di << "Radius - Point - Radius ??\n";
-        return 1;
+        //C-P-R
+        Geom2dGcc_Circ2d2TanRad aCt3(Geom2dGcc::Unqualified(aC[0]),
+                                     new Geom2d_CartesianPoint(aP[0]),
+                                     aRadius, aTol);
+        theDI << "Solution of type C-P-R is: ";
+        return solutions(theDI, aCt3, theArgVals[1]);
+      }
+      else
+      {
+        // C-P
+        Geom2dGcc_Circ2dTanCen aCt2(Geom2dGcc::Unqualified(aC[0]),
+                                    new Geom2d_CartesianPoint(aP[0]), aTol);
+        theDI << "Solution of type C-P is: ";
+        return solutions(theDI, aCt2, theArgVals[1]);
       }
     }
-    else {
-      // R-R-..
-      di << "radius, radius ???\n";
-      return 1;
+
+    theDI << "Error: Unsupported set of input data!\n";
+    return 1;
+  }
+  else if (aNbPnts >= 2)
+  {
+    if (aNbPnts == 3)
+    {
+      //P-P-P
+      Geom2dGcc_Circ2d3Tan aCt3(new Geom2d_CartesianPoint(aP[0]),
+                                new Geom2d_CartesianPoint(aP[1]),
+                                new Geom2d_CartesianPoint(aP[2]),
+                                aTol);
+      theDI << "Solution of type P-P-P is: ";
+      return solutions(theDI, aCt3, theArgVals[1]);
+    }
+    else if (aRadius > 0)
+    {
+      //P-P-R
+      Geom2dGcc_Circ2d2TanRad aCt3(new Geom2d_CartesianPoint(aP[0]),
+                                   new Geom2d_CartesianPoint(aP[1]),
+                                   aRadius, aTol);
+      theDI << "Solution of type P-P-R is: ";
+      return solutions(theDI, aCt3, theArgVals[1]);
     }
+
+    theDI << "Error: Unsupported set of input data!\n";
+    return 1;
   }
+
+  theDI << "Error: Unsupported set of input data!\n";
+  return 1;
 }
 
 
@@ -805,9 +754,9 @@ void  GeometryTest::ConstraintCommands(Draw_Interpretor& theCommands)
   g = "GEOMETRY Constraints";
 
   theCommands.Add("cirtang",
-    "cirtang cname curve/point/radius curve/point/radius curve/point/radius",
+    "cirtang cname [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...",
     __FILE__,
-    cirtang,g);
+    Cirtang, g);
 
   theCommands.Add("lintan",
     "lintan lname curve1 curve2 [angle]",
old mode 100755 (executable)
new mode 100644 (file)
similarity index 77%
rename from tests/bugs/moddata_1/buc60607_1
rename to tests/lowalgos/2dgcc/buc60607_1
index 5c30838..e0b9acb
@@ -7,6 +7,6 @@ set len_ch 2513
 
 point p 1600 300
 line l 0 500 2000 500
-cirtang c p l 400
+cirtang c -p p -c l -r 400
 checklength c_1 -l 2513.2741228718346
 checklength c_2 -l 2513.2741228718346
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
similarity index 85%
rename from tests/bugs/moddata_1/buc60607_2
rename to tests/lowalgos/2dgcc/buc60607_2
index f602def..cc9af48
@@ -5,4 +5,4 @@ puts "======================="
 
 point p 1600 300
 line l 0 500 2000 500
-cirtang c1 p l 200
+cirtang c1 -p p -c l -r 200
old mode 100755 (executable)
new mode 100644 (file)
similarity index 84%
rename from tests/bugs/moddata_1/buc60607_3
rename to tests/lowalgos/2dgcc/buc60607_3
index e4a5088..b23daa2
@@ -5,4 +5,4 @@ puts "======================="
 
 point p2 1400 1400
 line l2 3000 1700 1000 1550
-cirtang c3 p2 l2 300
+cirtang c3 -p p2 -c l2 -r 300
old mode 100755 (executable)
new mode 100644 (file)
similarity index 83%
rename from tests/bugs/moddata_1/buc60607_4
rename to tests/lowalgos/2dgcc/buc60607_4
index b461cb1..85c033e
@@ -5,4 +5,4 @@ puts "======================="
 
 point p2 1400 1400
 line l2 3000 1700 1000 1550
-cirtang result p2 l2 150
+cirtang result -p p2 -c l2 -r 150
old mode 100755 (executable)
new mode 100644 (file)
similarity index 89%
rename from tests/bugs/moddata_1/buc60618
rename to tests/lowalgos/2dgcc/buc60618
index 6cb3626..17b68cf
@@ -10,7 +10,7 @@ puts ""
 circle c1 0 0 100 
 circle c2 500 -400 300 
 circle c3 300 200 200 
-cirtang result c1 c2 c3
+cirtang result -c c1 -c c2 -c c3
 checklength result_1 -l 3568.9587306060739
 checklength result_2 -l 9964.7111736227271
 checklength result_3 -l 2082.9371204466097
old mode 100755 (executable)
new mode 100644 (file)
similarity index 86%
rename from tests/bugs/moddata_1/buc60622_1
rename to tests/lowalgos/2dgcc/buc60622_1
index 2bbee56..846561d
@@ -10,5 +10,5 @@ puts ""
 circle c1 2900 800 500 
 circle c2 2900 900 400 
 circle c3 2900 1000 300 
-catch {cirtang result c1 c2 c3}
+catch {cirtang result -c c1 -c c2 -c c3}
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 85%
rename from tests/bugs/moddata_1/buc60622_2
rename to tests/lowalgos/2dgcc/buc60622_2
index 0e7586d..1a6b3fe
@@ -10,7 +10,7 @@ puts ""
 circle c1 500 1800 500 
 circle c2 500 1900 400 
 circle c3 700 1900 200 
-cirtang result c1 c2 c3
+cirtang result -c c1 -c c2 -c c3
 
 checklength result_1 -l 2513.2741228703289
 checklength result_2 -l 837.75804095727631
old mode 100755 (executable)
new mode 100644 (file)
similarity index 87%
rename from tests/bugs/moddata_1/buc60622_3
rename to tests/lowalgos/2dgcc/buc60622_3
index 6861fe6..6dfa202
@@ -10,7 +10,7 @@ puts ""
 circle c3 500 3000 250
 circle c2 375 3000 125
 circle c1 625 3000 125
-cirtang result c1 c2 c3
+cirtang result -c c1 -c c2 -c c3
 
 checklength result_1 -l 1570.7963267948965
 checklength result_2 -l 785.39816339744868
old mode 100755 (executable)
new mode 100644 (file)
similarity index 92%
rename from tests/bugs/moddata_1/buc60941
rename to tests/lowalgos/2dgcc/buc60941
index 2129b5c..94a101a
@@ -13,7 +13,7 @@ set knots { { 0 4 } { 8.6971225126475 1 } { 16.903955884905 1 } { 28.00871675581
 
 eval 2dbsplinecurve curve_2 3 [ llength $knots ] [ join $knots ] [ join $poles ]
 
-if [catch {cirtang result curve_1 curve_2 2} catch_result] {
+if [catch {cirtang result -c curve_1 -c curve_2 -r 2} catch_result] {
     puts "Faulty BUC60941: function cirtang works wrongly"
 } else {
     puts "BUC60941  OK: function cirtang works properly"
similarity index 86%
rename from tests/bugs/moddata_3/bug23866
rename to tests/lowalgos/2dgcc/bug23866
index 18b3086..663e584 100644 (file)
@@ -18,7 +18,10 @@ to2d 2d_curve_1 3d_curve_1
 to2d 2d_curve_2 3d_curve_2
 to2d 2d_curve_3 3d_curve_3
 
-set circles_Nb [llength [cirtang cir 2d_curve_1 2d_curve_2 2d_curve_3] ]
+foreach a [directory cir*] { unset $a }
+cirtang cir -c 2d_curve_1 -c 2d_curve_2 -c 2d_curve_3
+
+set circles_Nb [llength [directory cir*] ]
 
 if { ${circles_Nb} != 8 } {
    puts "Error: GccAna_Circ2d3Tan does not find a circle"
diff --git a/tests/lowalgos/2dgcc/bug29694 b/tests/lowalgos/2dgcc/bug29694
new file mode 100644 (file)
index 0000000..7b14751
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0029694: Geom2dGcc_Circ2dTanCenGeo crash"
+puts "========"
+puts ""
+
+point pp 1 1
+2dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1
+
+if { ![regexp {Solution of type C-P is} [cirtang result -p pp -c cc] ] } {
+  puts "Error: Cannot find any solution"
+}
+
+regexp "Center\\s*:\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*" [dump result_1] full pcx pcy
+
+checkreal CenterX $pcx 1.0 1.0e-7 0
+checkreal CenterX $pcy 1.0 1.0e-7 0
+
+checkdump result_1 -name Radius -ref 6
diff --git a/tests/lowalgos/2dgcc/doc001 b/tests/lowalgos/2dgcc/doc001
new file mode 100644 (file)
index 0000000..a5531c7
--- /dev/null
@@ -0,0 +1,10 @@
+point p 0 0 
+line l 10 0 -1 1 
+cirtang c -p p -c l -r 4 
+
+smallview -2D-
+don c_1 c_2
+2dfit
+disp l p
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
index 9a19d5f..c3848ca 100644 (file)
@@ -1,4 +1,5 @@
 001 2dinter
 002 bnd
 003 extcs
-004 extcc
\ No newline at end of file
+004 extcc
+005 2dgcc
\ No newline at end of file