1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0030305: Strange logic in BRepMesh_Deflection::ComputeDeflection(...) method

Before the fix, angular deflection was scaled to some coefficient in the method BRepMesh_Deflection::ComputeDeflection(...). Now, angular deflection is constant.
This commit is contained in:
nbv 2018-10-25 15:21:34 +03:00 committed by bugmaster
parent 46478ffe32
commit 6933df8fe0
2 changed files with 15 additions and 32 deletions

View File

@ -31,10 +31,8 @@
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;

View 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 (