From a20400b3a2c1ebda9f7e5b103f4b1de105068cdf Mon Sep 17 00:00:00 2001 From: skv Date: Fri, 15 Feb 2013 16:55:25 +0400 Subject: [PATCH] 0023733: PCurve for edge on face creation failure Adding test case for this fix --- src/Extrema/Extrema_ExtPElC.cxx | 3 ++- src/Extrema/Extrema_ExtPRevS.cxx | 38 +++++++++++++++++++++++++----- tests/bugs/moddata/bug23733 | 40 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) create mode 100755 tests/bugs/moddata/bug23733 diff --git a/src/Extrema/Extrema_ExtPElC.cxx b/src/Extrema/Extrema_ExtPElC.cxx index a3e9c6441b..685c7c004c 100755 --- a/src/Extrema/Extrema_ExtPElC.cxx +++ b/src/Extrema/Extrema_ExtPElC.cxx @@ -228,8 +228,9 @@ Method: Us = Sol.Value(NoSol); Cu = ElCLib::Value(Us,C); mySqDist[myNbExt] = Cu.SquareDistance(P); - myIsMin[myNbExt] = (NoSol == 1); myPoint[myNbExt] = Extrema_POnCurv(Us,Cu); + Cu = ElCLib::Value(Us + 0.1, C); + myIsMin[myNbExt] = mySqDist[myNbExt] < Cu.SquareDistance(P); myNbExt++; } myDone = Standard_True; diff --git a/src/Extrema/Extrema_ExtPRevS.cxx b/src/Extrema/Extrema_ExtPRevS.cxx index ac49e569b1..f2beb94f75 100755 --- a/src/Extrema/Extrema_ExtPRevS.cxx +++ b/src/Extrema/Extrema_ExtPRevS.cxx @@ -363,7 +363,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P) newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI); if (newV > myvsup) { - newV = myvsup; + newV -= 2. * M_PI; + + if (newV + mytolv < myvinf) { + newV = myvsup; + } else if (newV < myvinf) { + newV = myvinf; + } } } V = newV; @@ -382,8 +388,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P) (anACurve->GetType() == GeomAbs_Ellipse)) { newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup); - if(newV < myvinf) - newV = myvinf; + if(newV < myvinf) { + newV += 2. * M_PI; + + if (newV - mytolv > myvsup) { + newV = myvinf; + } else if (newV > myvsup) { + newV = myvsup; + } + } } V = newV; @@ -422,7 +435,13 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P) newV = ElCLib::InPeriod(V, myvinf, myvinf + 2. * M_PI); if (newV > myvsup) { - newV = myvsup; + newV -= 2. * M_PI; + + if (newV + mytolv < myvinf) { + newV = myvsup; + } else if (newV < myvinf) { + newV = myvinf; + } } } V = newV; @@ -438,8 +457,15 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P) (anACurve->GetType() == GeomAbs_Ellipse)) { newV = ElCLib::InPeriod(V, myvsup - 2. * M_PI, myvsup); - if(newV < myvinf) - newV = myvinf; + if(newV < myvinf) { + newV += 2. * M_PI; + + if (newV - mytolv > myvsup) { + newV = myvinf; + } else if (newV > myvsup) { + newV = myvsup; + } + } } V = newV; diff --git a/tests/bugs/moddata/bug23733 b/tests/bugs/moddata/bug23733 new file mode 100755 index 0000000000..e80fd46c2c --- /dev/null +++ b/tests/bugs/moddata/bug23733 @@ -0,0 +1,40 @@ +puts "================" +puts "CR23733" +puts "================" +puts "" +############################################### +## PCurve for edge on face creation failure +############################################### + +pload DCAF TOPTEST + +Open [locate_data_file bug_glue_edges_GEOM.sgd] D + +GetShape D 0:1:9686:1:1:2 s1 +GetShape D 0:1:9449:1:1:2 s2 +explode s1 e +explode s2 f + +#should create pcurve +bhaspc s1_100 s2_2 do +#should report OK +set info1 [bhaspc s1_100 s2_2] +if { [regexp {No} ${info1}] == 1 } { + puts "Faulty: No 2D curves detected" +} + +#should create pcurve +bhaspc s1_40 s2_54 do +#should report OK +set info2 [bhaspc s1_40 s2_54] +if { [regexp {No} ${info2}] == 1 } { + puts "Faulty: No 2D curves detected" +} + +#should create pcurve +bhaspc s1_22 s2_123 do +#should report OK +set info3 [bhaspc s1_22 s2_123] +if { [regexp {No} ${info3}] == 1 } { + puts "Faulty: No 2D curves detected" +}