Correct adjusting pcurves on periodic surfaces: take the middle point as a reference point.
//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)
{
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());
--- /dev/null
+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
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
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