From 751d055356c3ca4684b6e3f5ca3f2a0b8a865540 Mon Sep 17 00:00:00 2001 From: ifv Date: Thu, 4 Oct 2018 16:06:54 +0300 Subject: [PATCH] 0030194: Modeling Algorithms - Intersection points between line and torus are not found Calling numerical solution is implemented if analytical algorithm fails --- src/IntAna/IntAna_IntLinTorus.cxx | 14 +++++++++++-- tests/bugs/modalg_7/bug29530 | 32 ++++++++++++++++++++++++++++++ tests/bugs/modalg_7/bug30194 | 33 +++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/modalg_7/bug29530 create mode 100644 tests/bugs/modalg_7/bug30194 diff --git a/src/IntAna/IntAna_IntLinTorus.cxx b/src/IntAna/IntAna_IntLinTorus.cxx index 36174e14b6..b1cf38e53b 100644 --- a/src/IntAna/IntAna_IntLinTorus.cxx +++ b/src/IntAna/IntAna_IntLinTorus.cxx @@ -79,6 +79,7 @@ void IntAna_IntLinTorus::Perform (const gp_Lin& L, const gp_Torus& T) { if(mdpr.IsDone()) { Standard_Integer nbsolvalid = 0; Standard_Integer n = mdpr.NbSolutions(); + Standard_Integer aNbBadSol = 0; for(Standard_Integer i = 1; i<=n ; i++) { Standard_Real t = mdpr.Value(i); t += ParamOfNewPL; @@ -88,6 +89,7 @@ void IntAna_IntLinTorus::Perform (const gp_Lin& L, const gp_Torus& T) { a0 = PSolT.SquareDistance(PSolL); if(a0>0.0000000001) { + aNbBadSol++; #if 0 cout<<" ------- Erreur : P Ligne < > P Tore "< 0 && nbsolvalid == 0 && aNbBadSol == n) + { + nbpt = 0; + done = Standard_False; + } + else + { + nbpt = nbsolvalid; + done = Standard_True; + } } else { nbpt = 0; diff --git a/tests/bugs/modalg_7/bug29530 b/tests/bugs/modalg_7/bug29530 new file mode 100644 index 0000000000..f4cd7a5cba --- /dev/null +++ b/tests/bugs/modalg_7/bug29530 @@ -0,0 +1,32 @@ +puts "========" +puts "0029530: Cannot intersec line with torus" +puts "========" +puts "" + +line l 20849.8369546166 -51477.7110215995 0 0 0 1 +torus s1 20849.8369546165 -16150.0401784893 -0.465280626514954 0 0 -1 -1 0 0 36035.8315681522 1000.78348430862 + +intersect result l s1 + +set full1 "" +regexp "Point\\s*:\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*" [dump result_1] full1 px1 py1 pz1 + +if {$full1 != ""} { + checkreal PointX $px1 2.084983695461660e+004 1.0e-7 0 + checkreal PointY $py1 -5.147771102159950e+004 1.0e-7 0 + checkreal PointZ $pz1 7.066952174026758e+002 1.0e-7 0 +} else { + puts "Error : no intersection point" +} + +set full2 "" +regexp "Point\\s*:\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*" [dump result_2] full2 px2 py2 pz2 + +if {$full2 != ""} { + checkreal PointX $px2 2.084983695461660e+004 1.0e-7 0 + checkreal PointY $py2 -5.147771102159950e+004 1.0e-7 0 + checkreal PointZ $pz2 -7.076257786556961e+002 1.0e-7 0 +} else { + puts "Error : no intersection point" +} + diff --git a/tests/bugs/modalg_7/bug30194 b/tests/bugs/modalg_7/bug30194 new file mode 100644 index 0000000000..87b421e42a --- /dev/null +++ b/tests/bugs/modalg_7/bug30194 @@ -0,0 +1,33 @@ +puts "========" +puts "0030194: Modeling Algorithms - Intersection points between line and torus are not found" +puts "========" +puts "" + +restore [locate_data_file bug30194_HA-8579.brep] a +line l 18000 2000 4000 0 0 -1 +explode a f +mksurface s1 a_1 +intersect result l s1 + +set full1 "" +regexp "Point\\s*:\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*" [dump result_1] full1 px1 py1 pz1 + +if {$full1 != ""} { + checkreal PointX $px1 1.8e4 1.0e-7 0 + checkreal PointY $py1 2.0e3 1.0e-7 0 + checkreal PointZ $pz1 7.898712797729002e+003 1.0e-7 0 +} else { + puts "Error : no intersection point" +} + +set full2 "" +regexp "Point\\s*:\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*,\\s*(\[-0-9.+eE\]+)\\s*" [dump result_2] full2 px2 py2 pz2 + +if {$full2 != ""} { + checkreal PointX $px2 1.8e4 1.0e-7 0 + checkreal PointY $py2 2.0e3 1.0e-7 0 + checkreal PointZ $pz2 1.012872022709980e+002 1.0e-7 0 +} else { + puts "Error : no intersection point" +} +