From 894dba72a3798c807367a1c897f85bd024822677 Mon Sep 17 00:00:00 2001 From: nbv Date: Tue, 22 May 2018 12:15:27 +0300 Subject: [PATCH] 0029694: Geom2dGcc_Circ2dTanCenGeo crash 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. --- .../draw_test_harness/draw_test_harness.md | 27 +- src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx | 25 +- .../GeometryTest_ConstraintCommands.cxx | 431 ++++++++---------- .../moddata_1 => lowalgos/2dgcc}/buc60607_1 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60607_2 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60607_3 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60607_4 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60618 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60622_1 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60622_2 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60622_3 | 2 +- .../moddata_1 => lowalgos/2dgcc}/buc60941 | 2 +- .../moddata_3 => lowalgos/2dgcc}/bug23866 | 5 +- tests/lowalgos/2dgcc/bug29694 | 18 + tests/lowalgos/2dgcc/doc001 | 10 + tests/lowalgos/grids.list | 3 +- 16 files changed, 265 insertions(+), 272 deletions(-) rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60607_1 (90%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60607_2 (85%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60607_3 (84%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60607_4 (83%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60618 (95%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60622_1 (86%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60622_2 (93%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60622_3 (94%) mode change 100755 => 100644 rename tests/{bugs/moddata_1 => lowalgos/2dgcc}/buc60941 (92%) mode change 100755 => 100644 rename tests/{bugs/moddata_3 => lowalgos/2dgcc}/bug23866 (86%) create mode 100644 tests/lowalgos/2dgcc/bug29694 create mode 100644 tests/lowalgos/2dgcc/doc001 diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index 587c56216d..ce6aee1bdb 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -5684,18 +5684,33 @@ projponf f pnt Syntax: ~~~~~ -cirtang cname curve/point/radius curve/point/radius curve/point/radius +cirtang result [-t ] -c -p -r ... ~~~~~ -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 diff --git a/src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx b/src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx index d7487d39df..44d8700e23 100644 --- a/src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx @@ -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)=Geom2dGcc_CurveTool::FirstParameter(curve) && - thePar <= Geom2dGcc_CurveTool::LastParameter(curve)) { + 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(); diff --git a/src/GeometryTest/GeometryTest_ConstraintCommands.cxx b/src/GeometryTest/GeometryTest_ConstraintCommands.cxx index 7dd9cca968..de80e1055b 100644 --- a/src/GeometryTest/GeometryTest_ConstraintCommands.cxx +++ b/src/GeometryTest/GeometryTest_ConstraintCommands.cxx @@ -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; + char solname[200]; - 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); + Draw_Color col = DrawTrSurf_CurveColor(Draw_Color(Draw_vert)); + DrawTrSurf_CurveColor(col); - 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]); - } + 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 << " "; } - 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]); - } + return 0; + } + else + { + theDI << "Circ2dTanCen Not done"; + return 1; + } +} - 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]); - } - - 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]); - } - } - - 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 ] -c -p -r ...\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 (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]); - } - - 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]); - } - } - - 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 { - // P-R-R - di << "Point, radius, radius ???\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; - } - } - 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) + else if (!strcmp(theArgVals[anArgID], "-c")) + { + if (aNbCurves >= 3) { - // 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"; + theDI << "A lot of curves are given (not greater than 3 ones are expected)\n"; return 1; } + + aC[aNbCurves] = DrawTrSurf::GetCurve2d(theArgVals[++anArgID]); + if (aC[aNbCurves].IsNull()) + { + theDI << "Error: " << theArgVals[anArgID] << " is not a curve\n"; + return 1; + } + + aNbCurves++; } - else { - // R-R-.. - di << "radius, radius ???\n"; + 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; + } + + 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; } } + + 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]); + } + + 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) + { + //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]); + } + } + + 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 ] -c -p -r ...", __FILE__, - cirtang,g); + Cirtang, g); theCommands.Add("lintan", "lintan lname curve1 curve2 [angle]", diff --git a/tests/bugs/moddata_1/buc60607_1 b/tests/lowalgos/2dgcc/buc60607_1 old mode 100755 new mode 100644 similarity index 90% rename from tests/bugs/moddata_1/buc60607_1 rename to tests/lowalgos/2dgcc/buc60607_1 index 5c30838c68..e0b9acbf7f --- a/tests/bugs/moddata_1/buc60607_1 +++ b/tests/lowalgos/2dgcc/buc60607_1 @@ -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 diff --git a/tests/bugs/moddata_1/buc60607_2 b/tests/lowalgos/2dgcc/buc60607_2 old mode 100755 new mode 100644 similarity index 85% rename from tests/bugs/moddata_1/buc60607_2 rename to tests/lowalgos/2dgcc/buc60607_2 index f602def4d5..cc9af484ff --- a/tests/bugs/moddata_1/buc60607_2 +++ b/tests/lowalgos/2dgcc/buc60607_2 @@ -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 diff --git a/tests/bugs/moddata_1/buc60607_3 b/tests/lowalgos/2dgcc/buc60607_3 old mode 100755 new mode 100644 similarity index 84% rename from tests/bugs/moddata_1/buc60607_3 rename to tests/lowalgos/2dgcc/buc60607_3 index e4a5088de8..b23daa28c2 --- a/tests/bugs/moddata_1/buc60607_3 +++ b/tests/lowalgos/2dgcc/buc60607_3 @@ -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 diff --git a/tests/bugs/moddata_1/buc60607_4 b/tests/lowalgos/2dgcc/buc60607_4 old mode 100755 new mode 100644 similarity index 83% rename from tests/bugs/moddata_1/buc60607_4 rename to tests/lowalgos/2dgcc/buc60607_4 index b461cb1307..85c033ebb2 --- a/tests/bugs/moddata_1/buc60607_4 +++ b/tests/lowalgos/2dgcc/buc60607_4 @@ -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 diff --git a/tests/bugs/moddata_1/buc60618 b/tests/lowalgos/2dgcc/buc60618 old mode 100755 new mode 100644 similarity index 95% rename from tests/bugs/moddata_1/buc60618 rename to tests/lowalgos/2dgcc/buc60618 index 6cb3626704..17b68cf99c --- a/tests/bugs/moddata_1/buc60618 +++ b/tests/lowalgos/2dgcc/buc60618 @@ -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 diff --git a/tests/bugs/moddata_1/buc60622_1 b/tests/lowalgos/2dgcc/buc60622_1 old mode 100755 new mode 100644 similarity index 86% rename from tests/bugs/moddata_1/buc60622_1 rename to tests/lowalgos/2dgcc/buc60622_1 index 2bbee56643..846561d72e --- a/tests/bugs/moddata_1/buc60622_1 +++ b/tests/lowalgos/2dgcc/buc60622_1 @@ -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} diff --git a/tests/bugs/moddata_1/buc60622_2 b/tests/lowalgos/2dgcc/buc60622_2 old mode 100755 new mode 100644 similarity index 93% rename from tests/bugs/moddata_1/buc60622_2 rename to tests/lowalgos/2dgcc/buc60622_2 index 0e7586dd3f..1a6b3fed6c --- a/tests/bugs/moddata_1/buc60622_2 +++ b/tests/lowalgos/2dgcc/buc60622_2 @@ -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 diff --git a/tests/bugs/moddata_1/buc60622_3 b/tests/lowalgos/2dgcc/buc60622_3 old mode 100755 new mode 100644 similarity index 94% rename from tests/bugs/moddata_1/buc60622_3 rename to tests/lowalgos/2dgcc/buc60622_3 index 6861fe6070..6dfa2026c8 --- a/tests/bugs/moddata_1/buc60622_3 +++ b/tests/lowalgos/2dgcc/buc60622_3 @@ -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 diff --git a/tests/bugs/moddata_1/buc60941 b/tests/lowalgos/2dgcc/buc60941 old mode 100755 new mode 100644 similarity index 92% rename from tests/bugs/moddata_1/buc60941 rename to tests/lowalgos/2dgcc/buc60941 index 2129b5cdd5..94a101a569 --- a/tests/bugs/moddata_1/buc60941 +++ b/tests/lowalgos/2dgcc/buc60941 @@ -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" diff --git a/tests/bugs/moddata_3/bug23866 b/tests/lowalgos/2dgcc/bug23866 similarity index 86% rename from tests/bugs/moddata_3/bug23866 rename to tests/lowalgos/2dgcc/bug23866 index 18b308630b..663e584a90 100644 --- a/tests/bugs/moddata_3/bug23866 +++ b/tests/lowalgos/2dgcc/bug23866 @@ -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 index 0000000000..7b147515c8 --- /dev/null +++ b/tests/lowalgos/2dgcc/bug29694 @@ -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 index 0000000000..a5531c7733 --- /dev/null +++ b/tests/lowalgos/2dgcc/doc001 @@ -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 diff --git a/tests/lowalgos/grids.list b/tests/lowalgos/grids.list index 9a19d5f110..c3848ca3b3 100644 --- a/tests/lowalgos/grids.list +++ b/tests/lowalgos/grids.list @@ -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