0026009: Wrong result of the test blend bfuseblend B7
authorjgv <jgv@opencascade.com>
Thu, 30 Apr 2015 11:46:18 +0000 (14:46 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 30 Apr 2015 11:47:57 +0000 (14:47 +0300)
Correction to avoid infinite loop

Minor correction

Update of test-case for issue #26009

Fix of compiler's warning

src/Blend/Blend_Walking_4.gxx
tests/blend/bfuseblend/B7

index 6d31e16..9cc1ab4 100644 (file)
@@ -16,6 +16,8 @@
 #include <Extrema_ExtPS.hxx>
 #include <Extrema_ExtPC.hxx>
 
+static const Standard_Real CosRef3D = 0.88;
+
 static void RecadreIfPeriodic(Standard_Real& NewU,
                               Standard_Real& NewV,
                               const Standard_Real OldU,
@@ -92,6 +94,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
                                    Blend_FuncInv& FuncInv,
                                    const Standard_Real Bound)
 {
+  Standard_Real Cosi = 0., Cosi2 = 0.;
 
   Standard_Real stepw = pasmax;
   Standard_Integer nbp = line->NbPoints();
@@ -105,6 +108,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
     stepw = Max(stepw,100.*tolgui);
   }
   Standard_Real parprec = param;
+  gp_Vec TgOnGuide, PrevTgOnGuide;
+  gp_Pnt PtOnGuide;
+  hguide->D1(parprec, PtOnGuide, TgOnGuide);
+  PrevTgOnGuide = TgOnGuide;
 
   if (sens*(parprec - Bound) >= -tolgui) {
     return;
@@ -145,6 +152,37 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
     sectioncalculee = 0;
     nbcomputedsection++;
 #endif
+
+    hguide->D1(param, PtOnGuide, TgOnGuide);
+    //Check deflection on guide
+    Cosi = PrevTgOnGuide * TgOnGuide;
+    if (Cosi < gp::Resolution()) //angle>=pi/2 or null magnitude
+      Cosi2 = 0.;
+    else
+      Cosi2 = Cosi * Cosi / PrevTgOnGuide.SquareMagnitude() / TgOnGuide.SquareMagnitude();
+    if (Cosi2 < CosRef3D) //angle 3d too great
+    {
+      State = Blend_StepTooLarge;
+      stepw = stepw/2.;
+      param = parprec + sens*stepw;  // on ne risque pas de depasser Bound.
+      if (Abs(stepw) < tolgui) {
+        Ext1.SetValue(previousP.PointOnS1(),
+                      sol(1),sol(2),
+                      previousP.Parameter(),tolesp);
+        Ext2.SetValue(previousP.PointOnS2(),
+                      sol(3),sol(4),
+                      previousP.Parameter(),tolesp);
+        if (!previousP.IsTangencyPoint()) {
+          Ext1.SetTangent(previousP.TangentOnS1());
+          Ext2.SetTangent(previousP.TangentOnS2());
+        }
+        Arrive = Standard_True;
+      }
+      continue;
+    }
+    PrevTgOnGuide = TgOnGuide;
+    //////////////////////////
+    
     Standard_Boolean bonpoint = 1;
     Func.Set(param);
     rsnld.Perform(Func,parinit,infbound,supbound);
index b962bb9..8fc8db9 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO OCC26009 All: Error: Cannot find the result of BLEND-operation."
-
 pcylinder s1 3 15 
 pcylinder s2 3 15 
 trotate s2 0 0 0 1 0 0 90