]> OCCT Git - occt-copy.git/commitdiff
0028692: Projection failed (projponf)
authorifv <ifv@opencascade.com>
Tue, 16 May 2017 14:37:13 +0000 (17:37 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 25 May 2017 08:37:04 +0000 (11:37 +0300)
Tolerance criterion is improved:
P.SquareDistance(p1) < Tol -> P.SquareDistance(p1) < Tol*Tol

src/Extrema/Extrema_ExtPElS.cxx
tests/bugs/modalg_6/bug28692 [new file with mode: 0644]

index 59d5bfe1c5b58c1033d9430340ddca3978c253b8..8257b554c0377826227728d5303d1a3eafc978dd 100644 (file)
@@ -313,9 +313,10 @@ void Extrema_ExtPElS::Perform(const gp_Pnt&       P,
                              const gp_Torus&     S,
                              const Standard_Real Tol)
 {
+  const Standard_Real tol2 = Tol*Tol;
   myDone = Standard_False;
   myNbExt = 0;
-
+  
 // Projection of P in plane XOY ...
   gp_Ax3 Pos = S.Position();
   gp_Pnt O = Pos.Location();
@@ -325,7 +326,7 @@ void Extrema_ExtPElS::Perform(const gp_Pnt&       P,
 // Calculation of extrema ...
   gp_Vec OPp (O,Pp);
   Standard_Real R2 = OPp.SquareMagnitude();
-  if (R2 < Tol * Tol) { return; }
+  if (R2 < tol2) { return; }
  
   gp_Vec myZ = Pos.XDirection()^Pos.YDirection();
   Standard_Real U1 = gp_Vec(Pos.XDirection()).AngleWithRef(OPp,myZ);
@@ -338,8 +339,8 @@ void Extrema_ExtPElS::Perform(const gp_Pnt&       P,
   gp_Pnt O1 = O.Translated(OO1);
   gp_Pnt O2 = O.Translated(OO2);
 
-  if(O1.SquareDistance(P) < Tol) { return; }
-  if(O2.SquareDistance(P) < Tol) { return; }
+  if(O1.SquareDistance(P) < tol2) { return; }
+  if(O2.SquareDistance(P) < tol2) { return; }
 
   Standard_Real V1 = OPp.AngleWithRef(gp_Vec(O1,P),OPp.Crossed(OZ));
   if (V1 > -ExtPElS_MyEps && V1 < ExtPElS_MyEps) { V1 = 0.; }
diff --git a/tests/bugs/modalg_6/bug28692 b/tests/bugs/modalg_6/bug28692
new file mode 100644 (file)
index 0000000..17eccde
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "OCC28692"
+puts "========"
+puts ""
+####################################################################################
+## Projection failed (projponf)
+####################################################################################
+
+restore [locate_data_file bug28692_shapes.brep] bi3
+point p -0.0153 0 0.017
+set dist -1
+regexp {proj dist = ([-0-9.+eE]+)} [projponf bi3 p] full dist
+if { $dist < 0 || $dist > 1.e-7 } { 
+  puts "Error : Projection failed " 
+} 
+