mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51: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:
parent
46478ffe32
commit
6933df8fe0
@ -31,10 +31,8 @@
|
|||||||
Standard_Real BRepMesh_Deflection::ComputeAbsoluteDeflection(
|
Standard_Real BRepMesh_Deflection::ComputeAbsoluteDeflection(
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theRelativeDeflection,
|
const Standard_Real theRelativeDeflection,
|
||||||
const Standard_Real theMaxShapeSize,
|
const Standard_Real theMaxShapeSize)
|
||||||
Standard_Real& theAdjustmentCoefficient)
|
|
||||||
{
|
{
|
||||||
theAdjustmentCoefficient = 1.;
|
|
||||||
if (theShape.IsNull())
|
if (theShape.IsNull())
|
||||||
{
|
{
|
||||||
return theRelativeDeflection;
|
return theRelativeDeflection;
|
||||||
@ -53,17 +51,17 @@ Standard_Real BRepMesh_Deflection::ComputeAbsoluteDeflection(
|
|||||||
const Standard_Real aMaxShapeSize = (theMaxShapeSize > 0.0) ? theMaxShapeSize :
|
const Standard_Real aMaxShapeSize = (theMaxShapeSize > 0.0) ? theMaxShapeSize :
|
||||||
Max(aX2 - aX1, Max(aY2 - aY1, aZ2 - aZ1));
|
Max(aX2 - aX1, Max(aY2 - aY1, aZ2 - aZ1));
|
||||||
|
|
||||||
theAdjustmentCoefficient = aMaxShapeSize / (2 * aShapeSize);
|
Standard_Real anAdjustmentCoefficient = aMaxShapeSize / (2 * aShapeSize);
|
||||||
if (theAdjustmentCoefficient < 0.5)
|
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 Standard_Real theMaxShapeSize,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
Standard_Real aLinDeflection;
|
const Standard_Real aAngDeflection = theParameters.Angle;
|
||||||
Standard_Real aAngDeflection;
|
Standard_Real aLinDeflection =
|
||||||
if (theParameters.Relative)
|
!theParameters.Relative ? theParameters.Deflection :
|
||||||
{
|
ComputeAbsoluteDeflection(theDEdge->GetEdge(),
|
||||||
Standard_Real aScale;
|
theParameters.Deflection,
|
||||||
aLinDeflection = ComputeAbsoluteDeflection(theDEdge->GetEdge(),
|
theMaxShapeSize);
|
||||||
theParameters.Deflection,
|
|
||||||
theMaxShapeSize, aScale);
|
|
||||||
|
|
||||||
// Is it OK?
|
|
||||||
aAngDeflection = theParameters.Angle * aScale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aLinDeflection = theParameters.Deflection;
|
|
||||||
aAngDeflection = theParameters.Angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopoDS_Edge& anEdge = theDEdge->GetEdge();
|
const TopoDS_Edge& anEdge = theDEdge->GetEdge();
|
||||||
|
|
||||||
@ -153,9 +140,8 @@ void BRepMesh_Deflection::ComputeDeflection (
|
|||||||
Standard_Real aDeflection = theParameters.DeflectionInterior;
|
Standard_Real aDeflection = theParameters.DeflectionInterior;
|
||||||
if (theParameters.Relative)
|
if (theParameters.Relative)
|
||||||
{
|
{
|
||||||
Standard_Real aScale;
|
|
||||||
aDeflection = ComputeAbsoluteDeflection(theDFace->GetFace(),
|
aDeflection = ComputeAbsoluteDeflection(theDFace->GetFace(),
|
||||||
aDeflection, -1.0, aScale);
|
aDeflection, -1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aFaceDeflection = 0.0;
|
Standard_Real aFaceDeflection = 0.0;
|
||||||
|
@ -36,14 +36,11 @@ public:
|
|||||||
//! @param theShape shape for that the deflection should be computed.
|
//! @param theShape shape for that the deflection should be computed.
|
||||||
//! @param theRelativeDeflection relative deflection.
|
//! @param theRelativeDeflection relative deflection.
|
||||||
//! @param theMaxShapeSize maximum size of the whole shape.
|
//! @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.
|
//! @return absolute deflection for the shape.
|
||||||
Standard_EXPORT static Standard_Real ComputeAbsoluteDeflection (
|
Standard_EXPORT static Standard_Real ComputeAbsoluteDeflection (
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theRelativeDeflection,
|
const Standard_Real theRelativeDeflection,
|
||||||
const Standard_Real theMaxShapeSize,
|
const Standard_Real theMaxShapeSize);
|
||||||
Standard_Real& theAdjustmentCoefficient);
|
|
||||||
|
|
||||||
//! Computes and updates deflection of the given discrete edge.
|
//! Computes and updates deflection of the given discrete edge.
|
||||||
Standard_EXPORT static void ComputeDeflection (
|
Standard_EXPORT static void ComputeDeflection (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user