]> OCCT Git - occt-copy.git/commitdiff
// minor
authorabv <abv@opencascade.com>
Wed, 17 Aug 2016 20:35:11 +0000 (23:35 +0300)
committerabv <abv@opencascade.com>
Wed, 17 Aug 2016 20:35:11 +0000 (23:35 +0300)
src/ApproxInt/ApproxInt_KnotTools.cxx
src/BRepMesh/BRepMesh_FastDiscretFace.cxx

index eb0e5bc55ab710ef37c5a8d3aa78aa77fa9a6567..7d7a77d021cb28d37517b75fbca2d42401a165b1 100644 (file)
@@ -28,9 +28,9 @@
 #include <TColgp_Array1OfPnt.hxx>
 
 // (Sqrt(5.0) - 1.0) / 4.0
-static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
+//static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
+static const Standard_Real aSinCoeff2 = 0.09549150281252627; // aSinCoeff^2 = (3. - Sqrt(5.)) / 8.
 static const Standard_Integer aMaxPntCoeff = 15;
-static const Standard_Real Epsilon1 = Epsilon(1.);
 
 //=======================================================================
 //function : EvalCurv
@@ -238,7 +238,6 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
       {
         Standard_Integer anIndPrev = theInds(j-1);
         Standard_Integer anIndNext = theInds(j+1);
-        Standard_Real sina;
         Standard_Integer ici = (anIndPrev - aCurv.Lower()) * theDim,
           ici1 = (anIndNext - aCurv.Lower()) * theDim,
           icm = (anInd - aCurv.Lower()) * theDim;
@@ -262,10 +261,8 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
         }
         //mp *= 2.; //P(j,i) = -P(i,j);
         //
-        sina = mp/(m1*m2);
-        sina = Sqrt(sina);
 
-        if(sina  > aSinCoeff) 
+        if(mp > aSinCoeff2 * m1 * m2) // Sqrt (mp/(m1*m2)) > aSinCoeff
         {
           //Insert new knots
           Standard_Real d1 = Abs(aCurv(anInd) - aCurv(anIndPrev));
@@ -494,7 +491,6 @@ Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
     {
       if(ChkCurv)
       {
-        Standard_Real sina;
         Standard_Integer ici = (anInd - theCurv.Lower()) * theDim,
           ici1 = (anInd1 - theCurv.Lower()) * theDim,
           icm = (mid - theCurv.Lower()) * theDim;
@@ -519,9 +515,8 @@ Standard_Boolean ApproxInt_KnotTools::InsKnotBefI(const Standard_Integer theI,
         }
         //mp *= 2.; //P(j,i) = -P(i,j);
         //
-        Standard_Real m1m2 = m1*m2;
-        sina = (m1m2 > Epsilon1 ? Sqrt (mp / m1m2) : 0.);
-        if(sina > aSinCoeff)
+
+        if (mp > aSinCoeff2 * m1 * m2) // Sqrt (mp / m1m2) > aSinCoeff
         {
           theInds.InsertBefore(theI, mid);
           return Standard_True;
index d017d37202a438aaca69c691c6438a694e24a5ba..e92fc7fd94451f049f3d91b4cc3dd3cc9d74e0b6 100644 (file)
@@ -984,7 +984,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
       gp_Pnt aPrevPnt2;
       gp_Vec aPrevVec2;
       aIso.D1 (aPrevParam2, aPrevPnt2, aPrevVec2);
-      Standard_Real aMod2PrevVec2 = aPrevVec2.SquareMagnitude();
       for (Standard_Integer j = 2; j <= aParams2.Length();)
       {
         Standard_Real aParam2 = aParams2(j);
@@ -1011,7 +1010,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
           if (aDist < aDefFace)
           {
             // Lets check parameters for angular deflection.
-            if (aMod2PrevVec2 > gp::Resolution() && (aPrevVec2.Angle(aNextVec) < myAngle))
+            if (aPrevVec2.SquareMagnitude() > gp::Resolution() &&
+                aNextVec.SquareMagnitude() > gp::Resolution() &&
+                aPrevVec2.Angle(aNextVec) < myAngle)
             {
               // For current Iso line we can remove this parameter.
 #ifdef DEBUG_InsertInternal
@@ -1026,7 +1027,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
               aPrevParam2 = aNextParam;
               aPrevPnt2 = aNextPnt;
               aPrevVec2 = aNextVec;
-              aMod2PrevVec2 = aPrevVec2.SquareMagnitude();
               j += 2;
               continue;
             }
@@ -1049,7 +1049,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
         aPrevParam2 = aParam2;
         aPrevPnt2 = aPnt2;
         aPrevVec2 = aVec2;
-        aMod2PrevVec2 = aPrevVec2.SquareMagnitude();
         ++j;
       }
     }