From: nbv Date: Thu, 17 Sep 2015 10:46:54 +0000 (+0300) Subject: 0026642: ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances X-Git-Tag: V7_0_0_beta~261 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=e784d86520e69264b5958855599b429239aa17bf 0026642: ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances Algorithm of computation of safe shift value along 2D-line (in order to distance between two points was less than tolerance) has been improved. Correction of some test cases in accordance with their new behavior. Test-case for issue #26642 Small correction of test-case Small correction of test-case bugs heal bug26642 --- diff --git a/src/IntCurve/IntCurve_IntConicConic_1.cxx b/src/IntCurve/IntCurve_IntConicConic_1.cxx index d31ea86372..4cc5be9a53 100644 --- a/src/IntCurve/IntCurve_IntConicConic_1.cxx +++ b/src/IntCurve/IntCurve_IntConicConic_1.cxx @@ -552,12 +552,12 @@ void DomainIntersection(const IntRes2d_Domain& Domain if(Domain.HasFirstPoint()) { if(U1sup < (Domain.FirstParameter()-Domain.FirstTolerance())) { - Res1inf=1; Res1sup=-1; - return; - } + Res1inf=1; Res1sup=-1; + return; + } if(U1inf>(Domain.FirstParameter()+Domain.FirstTolerance())) { - Res1inf=U1inf; - PosInf=IntRes2d_Middle; + Res1inf=U1inf; + PosInf=IntRes2d_Middle; } else { Res1inf=Domain.FirstParameter(); @@ -575,8 +575,8 @@ void DomainIntersection(const IntRes2d_Domain& Domain return; } if(U1sup<(Domain.LastParameter()-Domain.LastTolerance())) { - Res1sup=U1sup; - PosSup=IntRes2d_Middle; + Res1sup=U1sup; + PosSup=IntRes2d_Middle; } else { Res1sup=Domain.LastParameter(); @@ -602,9 +602,9 @@ void DomainIntersection(const IntRes2d_Domain& Domain /*if(PosInf==IntRes2d_Head) { if(Res1sup <= (Res1inf+Domain.FirstTolerance())) { Res1sup=Res1inf; - PosSup=IntRes2d_Head; + PosSup=IntRes2d_Head; + } } -} if(PosSup==IntRes2d_End) { if(Res1inf >= (Res1sup-Domain.LastTolerance())) { Res1inf=Res1sup; @@ -1232,12 +1232,12 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1 //-- 2 : Confondues a la tolerance pres Standard_Integer nbsol; IntRes2d_IntersectionPoint PtSeg1,PtSeg2; - Standard_Real SINL1L2; + Standard_Real aHalfSinL1L2; Standard_Real Tol = TolR; if(TolR< 1e-10) Tol = 1e-10; - LineLineGeometricIntersection(L1,L2,Tol,U1,U2,SINL1L2,nbsol); + LineLineGeometricIntersection(L1,L2,Tol,U1,U2,aHalfSinL1L2,nbsol); gp_Vec2d Tan1=L1.Direction(); gp_Vec2d Tan2=L2.Direction(); @@ -1257,7 +1257,7 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1 //-- d une distance superieure a Tol. //--------------------------------------------------- IntRes2d_Position Pos1a,Pos2a,Pos1b,Pos2b; - Standard_Real d=Tol/(SINL1L2); + Standard_Real d = 0.5 * Tol / aHalfSinL1L2; Standard_Real U1inf=U1-d; Standard_Real U1sup=U1+d; Standard_Real U1mU2=U1-U2; @@ -1367,7 +1367,7 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1 if(Res2sup_m_Res2inf < 0.0) { //-- Pas de solutions On retourne Vide } - else if(((Res2sup-Res2inf) > LongMiniSeg) + else if((Res2sup_m_Res2inf > LongMiniSeg) || ((Pos2a==Pos2b)&&(Pos2a!=IntRes2d_Middle))) { //----------- Calcul des attributs du segment -------------- //-- Attention, les bornes Res1inf(sup) bougent donc il faut @@ -1658,6 +1658,30 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1 } } } + +//#ifdef OCCT_DEBUG +// if (NbPoints() || NbSegments()) +// { +// static int cnt = 0; cnt++; +// +// printf("line l1_%03d %.15g %.15g %.15g %.15g\n", cnt, L1.Location().X(), L1.Location().Y(), L1.Direction().X(), L1.Direction().Y()); +// +// if (Domain1.HasFirstPoint() && Domain1.HasLastPoint()) +// printf("trim l1_%03d l1_%03d %.15g %.15g\n", cnt, cnt, Domain1.FirstParameter(), Domain1.LastParameter()); +// +// printf("line l2_%03d %.15g %.15g %.15g %.15g\n", cnt, L2.Location().X(), L2.Location().Y(), L2.Direction().X(), L2.Direction().Y()); +// +// if (Domain2.HasFirstPoint() && Domain2.HasLastPoint()) +// printf("trim l2_%03d l2_%03d %.15g %.15g\n", cnt, cnt, Domain2.FirstParameter(), Domain2.LastParameter()); +// +// for (int i=1; i <= NbPoints(); i++) +// printf("point p%d_%03d %.15g %.15g\n", i, cnt, Point(i).Value().X(), Point(i).Value().Y()); +// +// for (int i=1; i <= NbSegments(); i++) +// printf("point s1_%d_%03d %.15g %.15g; point s2_%d_%03d %.15g %.15g\n", i, cnt, Segment(i).FirstPoint().Value().X(), Segment(i).FirstPoint().Value().Y(), i, cnt, Segment(i).LastPoint().Value().X(), Segment(i).LastPoint().Value().Y()); +// } +//#endif + } else { if(nbsol==2) { //== Droites confondues a la tolerance pres diff --git a/tests/boolean/volumemaker/D5 b/tests/boolean/volumemaker/D5 index a39f4acdd9..66585826d2 100644 --- a/tests/boolean/volumemaker/D5 +++ b/tests/boolean/volumemaker/D5 @@ -3,6 +3,7 @@ puts "TODO OCC26020 ALL: Error: bopcheck failed" puts "TODO OCC26020 Linux: Error : The area of the resulting shape is" +puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to" # planar face plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016 diff --git a/tests/bugs/heal/bug26642 b/tests/bugs/heal/bug26642 new file mode 100644 index 0000000000..87de0b59f8 --- /dev/null +++ b/tests/bugs/heal/bug26642 @@ -0,0 +1,38 @@ +puts "========" +puts "OCC26642" +puts "========" +puts "" +############################################################################ +# ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances +############################################################################ + +restore [locate_data_file bug26656_unify.input.brep] i + +set bug_info [tolerance i] +set value_1 [lindex $bug_info 1] +set value_1 [string trim [string range $value_1 [expr {[string first "=" $value_1] + 1}] [expr {[string length $value_1] - 1}]]] + +unifysamedom r i + +set bug_info [tolerance i] +set value_2 [lindex $bug_info 1] +set value_2 [string trim [string range $value_2 [expr {[string first "=" $value_2] + 1}] [expr {[string length $value_2] - 1}]]] +set bug_info [tolerance r] +set value_3 [lindex $bug_info 1] +set value_3 [string trim [string range $value_3 [expr {[string first "=" $value_3] + 1}] [expr {[string length $value_3] - 1}]]] + +if {$value_1 > $value_2} { + set diff_12 [expr {$value_1 - $value_2}] +} else { + set diff_12 [expr {$value_2 - $value_1}] +} + +if {$value_1 > $value_3} { + set diff_13 [expr {$value_1 - $value_3}] +} else { + set diff_13 [expr {$value_3 - $value_1}] +} + +if {$diff_12 > 1.e-06 || $diff_13 > 1.e-06} { + puts "ERROR: OCC26642 is reproduced. Command unifysamedom works wrongly." +} diff --git a/tests/de/step_2/N8 b/tests/de/step_2/N8 index 3b7c5bea43..bb68feb83d 100644 --- a/tests/de/step_2/N8 +++ b/tests/de/step_2/N8 @@ -1,3 +1,5 @@ +puts "TODO OCC12345 ALL: TPSTAT : Faulty" + # !!!! This file is generated automatically, do not edit manually! See end script diff --git a/tests/offset/wire_unclosed_outside_0_025/B4 b/tests/offset/wire_unclosed_outside_0_025/B4 index 49cfa136ae..0fbddbf243 100644 --- a/tests/offset/wire_unclosed_outside_0_025/B4 +++ b/tests/offset/wire_unclosed_outside_0_025/B4 @@ -2,8 +2,8 @@ puts "TODO OCC25109 ALL: Faulty shapes in variables" restore [locate_data_file case_3_wire2.brep] s -set length 957.647 -set nbsh_v 86 -set nbsh_e 86 +set length 946.063 +set nbsh_v 79 +set nbsh_e 79 set nbsh_w 2