mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0032471: Mesh - Deflection of the triangulation is not recomputed for planar face
Method EstimateDeflection has been added to BRepLib in order to check and update value of deflection provided by Poly_Triangulation; Introduction of Poly_TriangulationParameters intended to keep info about initial parameters of mesh stored by Poly_Triangulation; BRepMesh stores user-specified parameters to Poly_Triangulation via Poly_TriangulationParameters; Prefer initial parameters of mesh generator stored in Poly_Triangulation during check of mesh consistency.
This commit is contained in:
@@ -243,7 +243,6 @@ void BRepMesh_BaseMeshAlgo::commitSurfaceTriangulation()
|
||||
|
||||
collectNodes(aTriangulation);
|
||||
|
||||
aTriangulation->Deflection(myDFace->GetDeflection());
|
||||
BRepMesh_ShapeTool::AddInFace(myDFace->GetFace(), aTriangulation);
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <IMeshData_Edge.hxx>
|
||||
#include <IMeshData_PCurve.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <Poly_TriangulationParameters.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
@@ -157,6 +159,47 @@ namespace
|
||||
|
||||
Handle(IMeshData_Model) myModel;
|
||||
};
|
||||
|
||||
//! Estimates and updates deflection of triangulations for corresponding faces.
|
||||
class DeflectionEstimator
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
DeflectionEstimator (const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParams)
|
||||
: myModel (theModel)
|
||||
, myParams (new Poly_TriangulationParameters (
|
||||
theParams.Deflection, theParams.Angle, theParams.MinSize))
|
||||
{
|
||||
}
|
||||
|
||||
//! Main functor.
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace (theFaceIndex);
|
||||
if (aDFace->IsSet (IMeshData_Failure) ||
|
||||
aDFace->IsSet (IMeshData_Reused))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BRepLib::UpdateDeflection (aDFace->GetFace());
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
const Handle(Poly_Triangulation)& aTriangulation =
|
||||
BRep_Tool::Triangulation (aDFace->GetFace(), aLoc);
|
||||
|
||||
if (!aTriangulation.IsNull())
|
||||
{
|
||||
aTriangulation->Parameters (myParams);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Handle(IMeshData_Model) myModel;
|
||||
Handle(Poly_TriangulationParameters) myParams;
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -181,7 +224,7 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& /*theParameters*/,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
(void )theRange;
|
||||
@@ -191,6 +234,10 @@ Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
|
||||
}
|
||||
|
||||
// TODO: Force single threaded solution due to data races on edges sharing the same TShape
|
||||
OSD_Parallel::For(0, theModel->EdgesNb(), PolygonCommitter(theModel), Standard_True/*!theParameters.InParallel*/);
|
||||
OSD_Parallel::For (0, theModel->EdgesNb(), PolygonCommitter (theModel), Standard_True/*!theParameters.InParallel*/);
|
||||
|
||||
// Estimate deflection here due to BRepLib::EstimateDeflection requires
|
||||
// existence of both Poly_Triangulation and Poly_PolygonOnTriangulation.
|
||||
OSD_Parallel::For (0, theModel->FacesNb(), DeflectionEstimator (theModel, theParameters), !theParameters.InParallel);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <IMeshData_PCurve.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <BRepMesh_ConeRangeSplitter.hxx>
|
||||
#include <Poly_TriangulationParameters.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
@@ -55,8 +56,15 @@ namespace
|
||||
|
||||
if (!aTriangulation.IsNull())
|
||||
{
|
||||
// If there is an info about initial parameters, use it due to deflection kept
|
||||
// by Poly_Triangulation is generally an estimation upon generated mesh and can
|
||||
// be either less or even greater than specified value.
|
||||
const Handle(Poly_TriangulationParameters)& aSourceParams = aTriangulation->Parameters();
|
||||
const Standard_Real aDeflection = (!aSourceParams.IsNull() && aSourceParams->HasDeflection()) ?
|
||||
aSourceParams->Deflection() : aTriangulation->Deflection();
|
||||
|
||||
Standard_Boolean isTriangulationConsistent =
|
||||
BRepMesh_Deflection::IsConsistent (aTriangulation->Deflection(),
|
||||
BRepMesh_Deflection::IsConsistent (aDeflection,
|
||||
aDFace->GetDeflection(),
|
||||
myAllowQualityDecrease);
|
||||
|
||||
|
Reference in New Issue
Block a user