mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0023106: BRepMesh_IncrementalMesh returns wrong status
Fix compilation errors on Linux platform Squeeze compilation warnings on Linux Fix regressions Back RemoveFaceAttribute for further reasons Fix retrieving of polygon by index Fix applying of location Test case for issue CR23106 Fix memory leak regression 'test bugs vis bug79' occurred due to incorrect memory cleaning of inherited objects by MMgtRaw::Free through BRepMesh_IEdgeTool; Replace BRepMesh_PDiscretRoot by pure pointer to BRepMesh_DiscretRoot; Fix IVtkOCC_ShapeMesher.
This commit is contained in:
@@ -13,16 +13,154 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_FaceAttribute.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
#include <BRepMesh_ShapeTool.hxx>
|
||||
#include <BRepMesh_Classifier.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (BRepMesh_FaceAttribute, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_FaceAttribute
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_FaceAttribute::BRepMesh_FaceAttribute():
|
||||
mydefface(0.), myumin(0.), myumax(0.), myvmin(0.), myvmax(0.),
|
||||
mydeltaX(1.), mydeltaY(1.), myminX(0.), myminY(0.)
|
||||
BRepMesh_FaceAttribute::BRepMesh_FaceAttribute(
|
||||
const TopoDS_Face& theFace,
|
||||
BRepMeshCol::DMapOfVertexInteger& theBoundaryVertices,
|
||||
BRepMeshCol::DMapOfIntegerPnt& theBoundaryPoints)
|
||||
: myDefFace (0.),
|
||||
myUMin (0.),
|
||||
myUMax (0.),
|
||||
myVMin (0.),
|
||||
myVMax (0.),
|
||||
myDeltaX (1.),
|
||||
myDeltaY (1.),
|
||||
myStatus (BRepMesh_NoError),
|
||||
myBoundaryVertices(theBoundaryVertices),
|
||||
myBoundaryPoints (theBoundaryPoints),
|
||||
myAllocator (new NCollection_IncAllocator(64000))
|
||||
{
|
||||
myVertexEdgeMap = new BRepMeshCol::IMapOfInteger;
|
||||
myInternalEdges = new BRepMeshCol::DMapOfShapePairOfPolygon;
|
||||
mySurfacePoints = new BRepMeshCol::DMapOfIntegerPnt;
|
||||
myClassifier = new BRepMesh_Classifier;
|
||||
|
||||
myFace = theFace;
|
||||
BRepTools::Update(myFace);
|
||||
myFace.Orientation(TopAbs_FORWARD);
|
||||
|
||||
BRepAdaptor_Surface aSurfAdaptor(myFace, Standard_False);
|
||||
mySurface = new BRepAdaptor_HSurface(aSurfAdaptor);
|
||||
|
||||
ResetStructure();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_FaceAttribute::~BRepMesh_FaceAttribute()
|
||||
{
|
||||
clearLocal();
|
||||
|
||||
mySurfaceVertices.Clear();
|
||||
mySurfacePoints->Clear();
|
||||
|
||||
myClassifier.Nullify();
|
||||
myAllocator.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : clearLocal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_FaceAttribute::clearLocal()
|
||||
{
|
||||
myStructure.Nullify();
|
||||
|
||||
myLocation2D.Clear();
|
||||
myVertexEdgeMap->Clear();
|
||||
myInternalEdges->Clear();
|
||||
|
||||
myAllocator->Reset(Standard_False);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ResetStructure
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(BRepMesh_DataStructureOfDelaun)& BRepMesh_FaceAttribute::ResetStructure()
|
||||
{
|
||||
clearLocal();
|
||||
myStructure = new BRepMesh_DataStructureOfDelaun(myAllocator);
|
||||
|
||||
BRepTools::UVBounds(myFace, myUMin, myUMax, myVMin, myVMax);
|
||||
Standard_Real aTolU = ToleranceU();
|
||||
Standard_Real aTolV = ToleranceV();
|
||||
|
||||
myStructure->Data().SetCellSize(14.0 * aTolU, 14.0 * aTolV);
|
||||
myStructure->Data().SetTolerance(aTolU, aTolV);
|
||||
return myStructure;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeParametricTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BRepMesh_FaceAttribute::computeParametricTolerance(
|
||||
const Standard_Real theFirstParam,
|
||||
const Standard_Real theLastParam) const
|
||||
{
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
return Max(Precision::PConfusion(), (theLastParam - theFirstParam) * aDeflectionUV);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getVertexIndex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_FaceAttribute::getVertexIndex(
|
||||
const TopoDS_Vertex& theVertex,
|
||||
Standard_Integer& theVertexIndex) const
|
||||
{
|
||||
if (myBoundaryVertices.IsBound(theVertex))
|
||||
theVertexIndex = myBoundaryVertices.Find(theVertex);
|
||||
else if (mySurfaceVertices.IsBound(theVertex))
|
||||
theVertexIndex = mySurfaceVertices.Find(theVertex);
|
||||
else
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_FaceAttribute::AddNode(
|
||||
const Standard_Integer theIndex,
|
||||
const gp_XY& theUV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability,
|
||||
Standard_Integer& theNodeIndex,
|
||||
Standard_Integer& theNodeOnEdgeIndex)
|
||||
{
|
||||
BRepMesh_Vertex aNode(theUV, theIndex, theMovability);
|
||||
theNodeIndex = myStructure->AddNode(aNode);
|
||||
theNodeOnEdgeIndex = myVertexEdgeMap->FindIndex(theNodeIndex);
|
||||
if (theNodeOnEdgeIndex == 0)
|
||||
theNodeOnEdgeIndex = myVertexEdgeMap->Add(theNodeIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Scale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_XY BRepMesh_FaceAttribute::Scale(const gp_XY& thePoint2d,
|
||||
const Standard_Boolean isToFaceBasis)
|
||||
{
|
||||
return isToFaceBasis ?
|
||||
gp_XY((thePoint2d.X() - myUMin) / myDeltaX, (thePoint2d.Y() - myVMin) / myDeltaY) :
|
||||
gp_XY(thePoint2d.X() * myDeltaX + myUMin, thePoint2d.Y() * myDeltaY + myVMin);
|
||||
}
|
||||
|
Reference in New Issue
Block a user