]> OCCT Git - occt.git/commitdiff
0033570: Modeling Algorithms - Incorrect result of cutting spheres
authorakaftasev <akaftasev@opencascade.com>
Mon, 8 Jul 2024 15:49:52 +0000 (16:49 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Tue, 9 Jul 2024 08:49:22 +0000 (09:49 +0100)
The reason of current problem lies inside projection algorithm
Function_SetUVBounds() for projection of circle onto sphere produces shifted bounds.
Incorrect checking of placement on summit of the sphere was fixed.

src/ProjLib/ProjLib_ComputeApprox.cxx
tests/bugs/modalg_8/bug33570 [new file with mode: 0644]

index 74cf49ea38320d59c647cb3f5d3611f9b3c5124a..ec336d94db30b50fb24e22b00807448ac133f802 100644 (file)
@@ -655,7 +655,7 @@ static void Function_SetUVBounds(Standard_Real& myU1,
         // si P1.Z() vaut +/- R on est sur le sommet : pas significatif.
         gp_Pnt pp = P1.Transformed(Trsf);
 
-        if ( Abs( Abs(pp.Z()) - R) < Tol) {
+        if ( Abs(pp.X() * pp.X() + pp.Y() * pp.Y() + pp.Z() * pp.Z() - R * R) < Tol) {
           gp_Pnt Center = Circle.Location();
           Standard_Real U,V;
           ElSLib::SphereParameters(gp_Ax3(gp::XOY()),1,Center, U, V);
diff --git a/tests/bugs/modalg_8/bug33570 b/tests/bugs/modalg_8/bug33570
new file mode 100644 (file)
index 0000000..62c04c2
--- /dev/null
@@ -0,0 +1,14 @@
+puts "================================"
+puts "0033570: Modeling Algorithms - Incorrect result of cutting spheres"
+puts "================================"
+puts ""
+
+psphere s1 4 
+psphere s2 1 
+ttranslate s1 0 5.5 18 
+ttranslate s2 0 4.5 14 
+
+bcut result s1 s2 
+
+checknbshapes result -vertex 4 -edge 7 -wire 2 -face 2
+checkview -display result -2d -path ${imagedir}/${test_image}.png