]> OCCT Git - occt.git/commitdiff
0030305: Strange logic in BRepMesh_Deflection::ComputeDeflection(...) method
authornbv <nbv@opencascade.com>
Thu, 25 Oct 2018 12:21:34 +0000 (15:21 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 2 Nov 2018 14:06:41 +0000 (17:06 +0300)
Before the fix, angular deflection was scaled to some coefficient in the method BRepMesh_Deflection::ComputeDeflection(...). Now, angular deflection is constant.

src/BRepMesh/BRepMesh_Deflection.cxx
src/BRepMesh/BRepMesh_Deflection.hxx

index bde26b833fefc38fabeff99a3976a56c4db07b54..9110114056360f46c62eeb2bec796c0e8c1c3393 100644 (file)
 Standard_Real BRepMesh_Deflection::ComputeAbsoluteDeflection(
   const TopoDS_Shape& theShape,
   const Standard_Real theRelativeDeflection,
-  const Standard_Real theMaxShapeSize,
-  Standard_Real&      theAdjustmentCoefficient)
+  const Standard_Real theMaxShapeSize)
 {
-  theAdjustmentCoefficient = 1.;
   if (theShape.IsNull())
   {
     return theRelativeDeflection;
@@ -53,17 +51,17 @@ Standard_Real BRepMesh_Deflection::ComputeAbsoluteDeflection(
   const Standard_Real aMaxShapeSize = (theMaxShapeSize > 0.0) ? theMaxShapeSize :
                                        Max(aX2 - aX1, Max(aY2 - aY1, aZ2 - aZ1));
 
-  theAdjustmentCoefficient = aMaxShapeSize / (2 * aShapeSize);
-  if (theAdjustmentCoefficient < 0.5)
+  Standard_Real anAdjustmentCoefficient = aMaxShapeSize / (2 * aShapeSize);
+  if (anAdjustmentCoefficient < 0.5)
   {
-    theAdjustmentCoefficient = 0.5;
+    anAdjustmentCoefficient = 0.5;
   }
-  else if (theAdjustmentCoefficient > 2.)
+  else if (anAdjustmentCoefficient > 2.)
   {
-    theAdjustmentCoefficient = 2.;
+    anAdjustmentCoefficient = 2.;
   }
 
-  return (theAdjustmentCoefficient * aShapeSize * theRelativeDeflection);
+  return (anAdjustmentCoefficient * aShapeSize * theRelativeDeflection);
 }
 
 //=======================================================================
@@ -75,23 +73,12 @@ void BRepMesh_Deflection::ComputeDeflection (
   const Standard_Real           theMaxShapeSize,
   const IMeshTools_Parameters&  theParameters)
 {
-  Standard_Real aLinDeflection;
-  Standard_Real aAngDeflection;
-  if (theParameters.Relative)
-  {
-    Standard_Real aScale;
-    aLinDeflection = ComputeAbsoluteDeflection(theDEdge->GetEdge(),
-                                               theParameters.Deflection,
-                                               theMaxShapeSize, aScale);
-
-    // Is it OK?
-    aAngDeflection = theParameters.Angle * aScale;
-  }
-  else
-  {
-    aLinDeflection = theParameters.Deflection;
-    aAngDeflection = theParameters.Angle;
-  }
+  const Standard_Real aAngDeflection = theParameters.Angle;
+  Standard_Real aLinDeflection =
+    !theParameters.Relative ? theParameters.Deflection :
+    ComputeAbsoluteDeflection(theDEdge->GetEdge(),
+                              theParameters.Deflection,
+                              theMaxShapeSize);
 
   const TopoDS_Edge& anEdge = theDEdge->GetEdge();
 
@@ -153,9 +140,8 @@ void BRepMesh_Deflection::ComputeDeflection (
   Standard_Real aDeflection = theParameters.DeflectionInterior;
   if (theParameters.Relative)
   {
-    Standard_Real aScale;
     aDeflection = ComputeAbsoluteDeflection(theDFace->GetFace(),
-                                            aDeflection, -1.0, aScale);
+                                            aDeflection, -1.0);
   }
 
   Standard_Real aFaceDeflection = 0.0;
index 8a7e05df9e32838ab10acf9eb7aa847b447c6002..35998a839b0467ed14eeefd4ff74e2f40458f8a7 100644 (file)
@@ -36,14 +36,11 @@ public:
   //! @param theShape shape for that the deflection should be computed.
   //! @param theRelativeDeflection relative deflection.
   //! @param theMaxShapeSize maximum size of the whole shape.
-  //! @param theAdjustmentCoefficient coefficient of adjustment between maximum 
-  //! size of shape and calculated relative deflection.
   //! @return absolute deflection for the shape.
   Standard_EXPORT static Standard_Real ComputeAbsoluteDeflection (
     const TopoDS_Shape& theShape,
     const Standard_Real theRelativeDeflection,
-    const Standard_Real theMaxShapeSize,
-    Standard_Real&      theAdjustmentCoefficient);
+    const Standard_Real theMaxShapeSize);
 
   //! Computes and updates deflection of the given discrete edge.
   Standard_EXPORT static void ComputeDeflection (