diff --git a/src/ProjLib/ProjLib_ComputeApprox.cxx b/src/ProjLib/ProjLib_ComputeApprox.cxx index 4d8269911f..e4745113d7 100644 --- a/src/ProjLib/ProjLib_ComputeApprox.cxx +++ b/src/ProjLib/ProjLib_ComputeApprox.cxx @@ -1246,7 +1246,9 @@ void ProjLib_ComputeApprox::Perform //Return curve home Standard_Real UFirst = F.FirstParameter(); - gp_Pnt P3d = C->Value( UFirst ); + Standard_Real ULast = F.LastParameter(); + Standard_Real Umid = (UFirst + ULast)/2; + gp_Pnt P3d = C->Value (Umid); Standard_Real u = 0., v = 0.; switch (SType) { @@ -1301,7 +1303,7 @@ void ProjLib_ComputeApprox::Perform if (F.UCouture || (F.VCouture && SType == GeomAbs_Sphere)) { Standard_Real aNbPer; - gp_Pnt2d P2d = F.Value(UFirst); + gp_Pnt2d P2d = F.Value (Umid); du = u - P2d.X(); du = (du < 0) ? (du - Precision::PConfusion()) : (du + Precision::PConfusion()); diff --git a/tests/bugs/modalg_7/bug32470 b/tests/bugs/modalg_7/bug32470 new file mode 100644 index 0000000000..99c842bb87 --- /dev/null +++ b/tests/bugs/modalg_7/bug32470 @@ -0,0 +1,22 @@ +puts "============================================" +puts "OCC32470: BOP wrong result on sphere and box" +puts "============================================" +puts "" + +psphere sph 10 +box b 20 100 100 +ttranslate b 0 -50 -50 +trotate b 0 0 10 0 -1 0 45 +bcut result sph b + +checkshape result + +checknbshapes result -t -vertex 3 -edge 5 -wire 2 -face 2 -shell 1 -solid 1 + +set tolres [checkmaxtol result] + +if { ${tolres} > 1.e-5} { + puts "Error: bad tolerance of result" +} + +checkprops result -s 1229.69 -v 3945.6 diff --git a/tests/bugs/moddata_3/bug5145 b/tests/bugs/moddata_3/bug5145 index a186a3d29b..b66dbe3dbc 100644 --- a/tests/bugs/moddata_3/bug5145 +++ b/tests/bugs/moddata_3/bug5145 @@ -17,6 +17,38 @@ trim c2 c pi 2.*pi project c2d1 c1 s project c2d2 c2 s +2dcvalue c2d1 0 x1 y1 +2dcvalue c2d1 pi x2 y2 +2dcvalue c2d2 pi x3 y3 +2dcvalue c2d2 2*pi x4 y4 + +set tol 1.e-9 + +if {[expr abs([dval x1]) - 4.7123885383825099] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs([dval y1]) - 1.5707963267948966] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs([dval x2]) - 6.2831853071795862] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs(-1.2217304763960311 - [dval y2])] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs([dval x3])] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs(-1.2217304763960311 - [dval y3])] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs([dval x4]) - 1.5707967687970734] > $tol} { + puts "Error: Wrong projection in 2D" +} +if {[expr abs([dval y4]) - 1.5707963267948948] > $tol} { + puts "Error: Wrong projection in 2D" +} + checklength c2d1 -l 3.68009 checklength c2d2 -l 3.68009 diff --git a/tests/draft/angle/K8 b/tests/draft/angle/K8 index 050389a6fd..f0211dbf18 100644 --- a/tests/draft/angle/K8 +++ b/tests/draft/angle/K8 @@ -10,4 +10,4 @@ bfuse f pt pr nexplode f f depouille result f 0 0 1 f_4 5 0 0 40 0 0 1 -checkprops result -s 10112.2 +checkprops result -s 9447.73