From 1dbdf099cdd2560386ef86181b17995d92260a67 Mon Sep 17 00:00:00 2001 From: ifv Date: Tue, 26 Jun 2018 14:54:35 +0300 Subject: [PATCH] 0029857: Incorrect behavior of Point-Curve Extrema Check for double solutions has been added in algorithms Extrema_ELPCOfLocateExtPC and Extrema_ELPCOfLocateExtPC2d that find extrema between point and curve. --- src/Extrema/Extrema_ELPCOfLocateExtPC.hxx | 4 +++ src/Extrema/Extrema_ELPCOfLocateExtPC2d.hxx | 4 +++ src/Extrema/Extrema_ExtPC.hxx | 4 +++ src/Extrema/Extrema_ExtPC2d.hxx | 4 +++ src/Extrema/Extrema_GExtPC.gxx | 31 ++++++++++++++++++--- tests/bugs/modalg_5/bug23706_27 | 4 +-- tests/bugs/modalg_5/bug23706_32 | 4 +-- tests/bugs/modalg_5/bug23706_37 | 4 +-- tests/bugs/modalg_5/bug23706_42 | 4 +-- tests/bugs/modalg_5/bug23706_47 | 4 +-- tests/bugs/modalg_5/bug23706_53 | 5 +--- tests/bugs/modalg_7/bug29857 | 26 +++++++++++++++++ tests/bugs/modalg_7/bug29857_1 | 27 ++++++++++++++++++ tests/de/step_2/J7 | 5 ++-- 14 files changed, 105 insertions(+), 25 deletions(-) create mode 100644 tests/bugs/modalg_7/bug29857 create mode 100644 tests/bugs/modalg_7/bug29857_1 diff --git a/src/Extrema/Extrema_ELPCOfLocateExtPC.hxx b/src/Extrema/Extrema_ELPCOfLocateExtPC.hxx index 31f2c34c4c..cb8d6d41de 100644 --- a/src/Extrema/Extrema_ELPCOfLocateExtPC.hxx +++ b/src/Extrema/Extrema_ELPCOfLocateExtPC.hxx @@ -114,6 +114,10 @@ protected: Standard_EXPORT void IntervalPerform (const gp_Pnt& P); + Standard_EXPORT void AddSol(const Standard_Real theU, + const gp_Pnt& theP, + const Standard_Real theSqDist, + const Standard_Boolean isMin); diff --git a/src/Extrema/Extrema_ELPCOfLocateExtPC2d.hxx b/src/Extrema/Extrema_ELPCOfLocateExtPC2d.hxx index 53ddfe8976..15191a7ff7 100644 --- a/src/Extrema/Extrema_ELPCOfLocateExtPC2d.hxx +++ b/src/Extrema/Extrema_ELPCOfLocateExtPC2d.hxx @@ -114,6 +114,10 @@ protected: Standard_EXPORT void IntervalPerform (const gp_Pnt2d& P); + Standard_EXPORT void AddSol(const Standard_Real theU, + const gp_Pnt2d& theP, + const Standard_Real theSqDist, + const Standard_Boolean isMin); diff --git a/src/Extrema/Extrema_ExtPC.hxx b/src/Extrema/Extrema_ExtPC.hxx index f5edcdd862..fb6d4c550b 100644 --- a/src/Extrema/Extrema_ExtPC.hxx +++ b/src/Extrema/Extrema_ExtPC.hxx @@ -114,6 +114,10 @@ protected: Standard_EXPORT void IntervalPerform (const gp_Pnt& P); + Standard_EXPORT void AddSol(const Standard_Real theU, + const gp_Pnt& theP, + const Standard_Real theSqDist, + const Standard_Boolean isMin); diff --git a/src/Extrema/Extrema_ExtPC2d.hxx b/src/Extrema/Extrema_ExtPC2d.hxx index 8c82ddfa6d..37c8e1e87c 100644 --- a/src/Extrema/Extrema_ExtPC2d.hxx +++ b/src/Extrema/Extrema_ExtPC2d.hxx @@ -114,6 +114,10 @@ protected: Standard_EXPORT void IntervalPerform (const gp_Pnt2d& P); + Standard_EXPORT void AddSol(const Standard_Real theU, + const gp_Pnt2d& theP, + const Standard_Real theSqDist, + const Standard_Boolean isMin); diff --git a/src/Extrema/Extrema_GExtPC.gxx b/src/Extrema/Extrema_GExtPC.gxx index b48055a5be..3e60b757d2 100644 --- a/src/Extrema/Extrema_GExtPC.gxx +++ b/src/Extrema/Extrema_GExtPC.gxx @@ -452,16 +452,39 @@ void Extrema_GExtPC::IntervalPerform(const ThePoint& P) } if ((U >= myuinf - mytolu) && (U <= myusup + mytolu)) { - PC.SetValues(U, PC.Value()); - mySqDist.Append(myExtPC.SquareDistance(i)); - myismin.Append(myExtPC.IsMin(i)); - mypoint.Append(PC); + AddSol(U, PC.Value(), + myExtPC.SquareDistance(i), + myExtPC.IsMin(i)); } } } } +//======================================================================= +//function : AddSol +//purpose : +//======================================================================= + +void Extrema_GExtPC::AddSol(const Standard_Real theU, const ThePoint& theP, + const Standard_Real theSqDist, + const Standard_Boolean isMin) +{ + Standard_Integer i, NbExt = mypoint.Length(); + for (i = 1; i <= NbExt; i++) + { + Standard_Real t = mypoint.Value(i).Parameter(); + if (Abs(t - theU) <= mytolu) + { + return; + } + } + ThePOnC PC(theU, theP); + mySqDist.Append(theSqDist); + myismin.Append(isMin); + mypoint.Append(PC); + + } //======================================================================= diff --git a/tests/bugs/modalg_5/bug23706_27 b/tests/bugs/modalg_5/bug23706_27 index 506d935440..212426b588 100644 --- a/tests/bugs/modalg_5/bug23706_27 +++ b/tests/bugs/modalg_5/bug23706_27 @@ -10,14 +10,12 @@ set x 3.0 set y 6.0 set z -3.0 set pp_ch1 1 -set pp_ch2 1 restore [locate_data_file bug23706_c03.draw] c set info [proj c $x $y $z] regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1 -regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2 -if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } { +if { $pp1 != $pp_ch1 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_5/bug23706_32 b/tests/bugs/modalg_5/bug23706_32 index 6f7bda2fd4..6ed1752f83 100644 --- a/tests/bugs/modalg_5/bug23706_32 +++ b/tests/bugs/modalg_5/bug23706_32 @@ -10,14 +10,12 @@ set x 3.0 set y 6.0 set z -3.0 set pp_ch1 1 -set pp_ch2 1 restore [locate_data_file bug23706_c04.draw] c set info [proj c $x $y $z] regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1 -regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2 -if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } { +if { $pp1 != $pp_ch1 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_5/bug23706_37 b/tests/bugs/modalg_5/bug23706_37 index 4ffd361388..c23967b1dd 100644 --- a/tests/bugs/modalg_5/bug23706_37 +++ b/tests/bugs/modalg_5/bug23706_37 @@ -10,14 +10,12 @@ set x 3.0 set y 6.0 set z -3.0 set pp_ch1 1 -set pp_ch2 1 restore [locate_data_file bug23706_c05.draw] c set info [proj c $x $y $z] regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1 -regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2 -if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } { +if { $pp1 != $pp_ch1 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_5/bug23706_42 b/tests/bugs/modalg_5/bug23706_42 index 7d133ce83b..605234607c 100644 --- a/tests/bugs/modalg_5/bug23706_42 +++ b/tests/bugs/modalg_5/bug23706_42 @@ -10,14 +10,12 @@ set x 3.0 set y 6.0 set z -3.0 set pp_ch1 1 -set pp_ch2 1 restore [locate_data_file bug23706_c07.draw] c set info [proj c $x $y $z] regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1 -regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2 -if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } { +if { $pp1 != $pp_ch1 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_5/bug23706_47 b/tests/bugs/modalg_5/bug23706_47 index abaa114e9c..4137b29bb4 100644 --- a/tests/bugs/modalg_5/bug23706_47 +++ b/tests/bugs/modalg_5/bug23706_47 @@ -10,14 +10,12 @@ set x 3.0 set y 6.0 set z -3.0 set pp_ch1 1 -set pp_ch2 1 restore [locate_data_file bug23706_c08.draw] c set info [proj c $x $y $z] regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1 -regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2 -if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } { +if { $pp1 != $pp_ch1 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_5/bug23706_53 b/tests/bugs/modalg_5/bug23706_53 index b5b2dad4eb..175706e845 100644 --- a/tests/bugs/modalg_5/bug23706_53 +++ b/tests/bugs/modalg_5/bug23706_53 @@ -16,7 +16,6 @@ set pp_ch4 5.0399884503606023 set pp_ch5 5.4804063007678074 set pp_ch6 6.2485611263687888 set pp_ch7 6.7381612209715556 -set pp_ch8 1.1738953633378706 restore [locate_data_file bug23706_c12.draw] c set info [proj c $x $y $z] @@ -28,15 +27,13 @@ regexp {parameter 4 += +([-0-9.+eE]+)} $info full pp4 regexp {parameter 5 += +([-0-9.+eE]+)} $info full pp5 regexp {parameter 6 += +([-0-9.+eE]+)} $info full pp6 regexp {parameter 7 += +([-0-9.+eE]+)} $info full pp7 -regexp {parameter 8 += +([-0-9.+eE]+)} $info full pp8 if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 || $pp4 != $pp_ch4 || $pp5 != $pp_ch5 || $pp6 != $pp_ch6 || - $pp7 != $pp_ch7 || - $pp8 != $pp_ch8} { + $pp7 != $pp_ch7 } { puts "Error : Projection is not correct" } else { puts "OK: Projection is correct" diff --git a/tests/bugs/modalg_7/bug29857 b/tests/bugs/modalg_7/bug29857 new file mode 100644 index 0000000000..b0bf10d12f --- /dev/null +++ b/tests/bugs/modalg_7/bug29857 @@ -0,0 +1,26 @@ +puts "========" +puts "OCC29857" +puts "========" +puts "" +#################################### +## Extrema between Point and Curve returns two results +## (there should be only one) that are actually the same +#################################### + + +restore [locate_data_file bug29857.brep] c +set info [proj c -53.9663741221239 118.723988602907 -57.6228206908223] + +set pp1 "" +set pp2 "" +regexp {ext_1} $info pp1 +regexp {ext_2} $info pp2 + +if { $pp2 != "" } { + puts "Error : Projection is not correct" +} +if { $pp1 != "" } { + puts "OK: Projection is correct" +} else { + puts "Error : Projection is not correct" +} diff --git a/tests/bugs/modalg_7/bug29857_1 b/tests/bugs/modalg_7/bug29857_1 new file mode 100644 index 0000000000..07e252a851 --- /dev/null +++ b/tests/bugs/modalg_7/bug29857_1 @@ -0,0 +1,27 @@ +puts "========" +puts "OCC29857_1" +puts "========" +puts "" +#################################### +## Extrema between Point and Curve returns three solutions +## (there should be only two), two of these are actually the same +#################################### + + +restore [locate_data_file bug29857_1.brep] c +set info [proj c -139.04514104219 128.256108703487 -64.9999999999983] + +set pp1 "" +set pp2 "" +set pp3 "" +regexp {ext_1} $info pp1 +regexp {ext_2} $info pp2 +regexp {ext_3} $info pp3 +if { $pp3 != "" } { + puts "Error : Projection is not correct" +} +if { $pp1 != "" && $pp2 != "" } { + puts "OK: Projection is correct" +} else { + puts "Error : Projection is not correct" +} diff --git a/tests/de/step_2/J7 b/tests/de/step_2/J7 index 0f7c0fccd7..aa27dfd710 100644 --- a/tests/de/step_2/J7 +++ b/tests/de/step_2/J7 @@ -1,15 +1,16 @@ # !!!! This file is generated automatically, do not edit manually! See end script puts "TODO CR23096 ALL: TPSTAT : Faulty" + set filename bm4_ct_punch.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 4 ) Summary = 0 ( 4 ) -TPSTAT : Faulties = 0 ( 0 ) Warnings = 32 ( 7 ) Summary = 32 ( 7 ) +TPSTAT : Faulties = 0 ( 0 ) Warnings = 31 ( 5 ) Summary = 31 ( 5 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) Summary = 1443 ( 1443 ) STATSHAPE : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 573 ( 573 ) -TOLERANCE : MaxTol = 0.255769437 ( 0.255769437 ) AvgTol = 0.0008786095241 ( 0.001031806589 ) +TOLERANCE : MaxTol = 0.01857875733 ( 0.344407912 ) AvgTol = 0.0002556280658 ( 0.00124778276 ) LABELS : N0Labels = 6 ( 6 ) N1Labels = 45 ( 45 ) N2Labels = 0 ( 0 ) TotalLabels = 51 ( 51 ) NameLabels = 11 ( 11 ) ColorLabels = 41 ( 41 ) LayerLabels = 21 ( 21 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 4 ( 4 ) -- 2.20.1