From 4391df896c9b713caad1cbe06b073272ca465189 Mon Sep 17 00:00:00 2001 From: ifv Date: Fri, 6 Aug 2021 14:49:14 +0300 Subject: [PATCH] 0026269: Modeling Data - Analytical extrema does not take into account trimmed input data 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 --- src/Extrema/Extrema_ExtCC.cxx | 170 ++++++++++++++++++++++++------- src/Extrema/Extrema_ExtCC.hxx | 49 ++++++--- tests/lowalgos/extcc/bug26269_1 | 24 +++++ tests/lowalgos/extcc/bug26269_2 | 24 +++++ tests/lowalgos/extcc/bug29712_13 | 19 +++- tests/lowalgos/extcc/bug29712_21 | 19 +++- tests/lowalgos/extcc/bug29712_22 | 21 ++-- tests/lowalgos/extcc/bug29712_24 | 20 +++- tests/lowalgos/extcc/bug29712_25 | 19 +++- tests/lowalgos/extcc/bug29712_29 | 20 +++- tests/lowalgos/extcc/bug29712_3 | 12 ++- tests/lowalgos/extcc/bug29712_32 | 19 +++- tests/lowalgos/extcc/bug29712_37 | 20 +++- tests/lowalgos/extcc/bug29712_5 | 11 +- 14 files changed, 359 insertions(+), 88 deletions(-) create mode 100644 tests/lowalgos/extcc/bug26269_1 create mode 100644 tests/lowalgos/extcc/bug26269_2 diff --git a/src/Extrema/Extrema_ExtCC.cxx b/src/Extrema/Extrema_ExtCC.cxx index fa77b80c79..e3bfe4a60e 100644 --- a/src/Extrema/Extrema_ExtCC.cxx +++ b/src/Extrema/Extrema_ExtCC.cxx @@ -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()); } diff --git a/src/Extrema/Extrema_ExtCC.hxx b/src/Extrema/Extrema_ExtCC.hxx index f3a41288ff..0a8ff0228a 100644 --- a/src/Extrema/Extrema_ExtCC.hxx +++ b/src/Extrema/Extrema_ExtCC.hxx @@ -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 index 0000000000..a07c5f6c81 --- /dev/null +++ b/tests/lowalgos/extcc/bug26269_1 @@ -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 index 0000000000..0726fd2dca --- /dev/null +++ b/tests/lowalgos/extcc/bug26269_2 @@ -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 diff --git a/tests/lowalgos/extcc/bug29712_13 b/tests/lowalgos/extcc/bug29712_13 index 36dc300487..3e54f3fd65 100644 --- a/tests/lowalgos/extcc/bug29712_13 +++ b/tests/lowalgos/extcc/bug29712_13 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_21 b/tests/lowalgos/extcc/bug29712_21 index f2a1b419fe..569a0687c4 100644 --- a/tests/lowalgos/extcc/bug29712_21 +++ b/tests/lowalgos/extcc/bug29712_21 @@ -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 diff --git a/tests/lowalgos/extcc/bug29712_22 b/tests/lowalgos/extcc/bug29712_22 index 9287c1f237..b9e5d07333 100644 --- a/tests/lowalgos/extcc/bug29712_22 +++ b/tests/lowalgos/extcc/bug29712_22 @@ -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 -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" +} diff --git a/tests/lowalgos/extcc/bug29712_24 b/tests/lowalgos/extcc/bug29712_24 index 280f73a4ed..7c0e22d63f 100644 --- a/tests/lowalgos/extcc/bug29712_24 +++ b/tests/lowalgos/extcc/bug29712_24 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_25 b/tests/lowalgos/extcc/bug29712_25 index c8bd0973ba..1503119687 100644 --- a/tests/lowalgos/extcc/bug29712_25 +++ b/tests/lowalgos/extcc/bug29712_25 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_29 b/tests/lowalgos/extcc/bug29712_29 index 0339082b9b..eeb9d4efa3 100644 --- a/tests/lowalgos/extcc/bug29712_29 +++ b/tests/lowalgos/extcc/bug29712_29 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_3 b/tests/lowalgos/extcc/bug29712_3 index e5424faea6..e996370645 100644 --- a/tests/lowalgos/extcc/bug29712_3 +++ b/tests/lowalgos/extcc/bug29712_3 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_32 b/tests/lowalgos/extcc/bug29712_32 index bd554f5035..53a41faeb9 100644 --- a/tests/lowalgos/extcc/bug29712_32 +++ b/tests/lowalgos/extcc/bug29712_32 @@ -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" +} diff --git a/tests/lowalgos/extcc/bug29712_37 b/tests/lowalgos/extcc/bug29712_37 index ab063504aa..f9efb64981 100644 --- a/tests/lowalgos/extcc/bug29712_37 +++ b/tests/lowalgos/extcc/bug29712_37 @@ -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 diff --git a/tests/lowalgos/extcc/bug29712_5 b/tests/lowalgos/extcc/bug29712_5 index b5794fadc3..c43d75dd96 100644 --- a/tests/lowalgos/extcc/bug29712_5 +++ b/tests/lowalgos/extcc/bug29712_5 @@ -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