The algorithm of finding of extrema solutions of a point and a torus in Extrema_ExtPElS has been corrected for the case of torus having major radius equal to zero.
Test cases are added.
if(O1.SquareDistance(P) < Tol) { return; }
if(O2.SquareDistance(P) < Tol) { return; }
- Standard_Real V1 = OO1.AngleWithRef(gp_Vec(O1,P),OO1.Crossed(OZ));
+ Standard_Real V1 = OPp.AngleWithRef(gp_Vec(O1,P),OPp.Crossed(OZ));
if (V1 > -ExtPElS_MyEps && V1 < ExtPElS_MyEps) { V1 = 0.; }
- Standard_Real V2 = OO2.AngleWithRef(gp_Vec(P,O2),OO2.Crossed(OZ));
+ OPp.Reverse();
+ Standard_Real V2 = OPp.AngleWithRef(gp_Vec(P,O2),OPp.Crossed(OZ));
if (V2 > -ExtPElS_MyEps && V2 < ExtPElS_MyEps) { V2 = 0.; }
if (V1 < 0.) { V1 += 2. * M_PI; }
--- /dev/null
+puts "========"
+puts "OCC27762"
+puts "========"
+puts ""
+#################################################
+# Incomplete result of SECTION operation
+#################################################
+
+restore [locate_data_file bug27762.brep] a
+explode a
+
+bclearobjects
+bcleartools
+baddobjects a_1
+baddtools a_2 a_3 a_4
+bfillds
+bbuild result
+
+checkshape result
+checknbshapes result -face 6 -edge 20
+view 1 +X+Y 728 450 400 400
+don result
+fit
+checkview -2d -screenshot -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "========"
+puts "OCC27762"
+puts "========"
+puts ""
+# This is the second script that tries to reproduce the source of the problem -
+# impossibility to project a point on a torus with major radius == 0
+
+torus s 0 10
+set out [proj s 1 0 0]
+if {[llength $out] != 4} {
+ puts "Error: projection failed"
+} else {
+ puts "OK : projection passed"
+}