mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Updated source files from path
This commit is contained in:
@@ -82,14 +82,14 @@ namespace {
|
||||
//function : BRepMesh_Delaun
|
||||
//purpose : Creates the triangulation with an empty Mesh data structure
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myCircles (theVertices.Length(), new NCollection_IncAllocator(
|
||||
BRepMesh::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
myMeshData = new BRepMesh_DataStructureOfDelaun(
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE),
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE),
|
||||
theVertices.Length() );
|
||||
Init( theVertices );
|
||||
}
|
||||
@@ -100,8 +100,8 @@ BRepMesh_Delaun::BRepMesh_Delaun(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
//purpose : Creates the triangulation with and existent Mesh data structure
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
const Handle( BRepMesh_DataStructureOfDelaun )& theOldMesh,
|
||||
BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertices.Length(), theOldMesh->Allocator() )
|
||||
{
|
||||
@@ -114,8 +114,8 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
//purpose : Creates the triangulation with and existent Mesh data structure
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
const Handle( BRepMesh_DataStructureOfDelaun )& theOldMesh,
|
||||
BRepMesh::Array1OfInteger& theVertexIndices)
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
|
||||
IMeshData::VectorOfInteger& theVertexIndices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertexIndices.Length(), theOldMesh->Allocator() )
|
||||
{
|
||||
@@ -135,18 +135,18 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
//function : Init
|
||||
//purpose : Initializes the triangulation with an Array of Vertex
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::Init(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
void BRepMesh_Delaun::Init(IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
{
|
||||
Bnd_Box2d aBox;
|
||||
Standard_Integer aLowerIdx = theVertices.Lower();
|
||||
Standard_Integer anUpperIdx = theVertices.Upper();
|
||||
BRepMesh::Array1OfInteger aVertexIndexes( aLowerIdx, anUpperIdx );
|
||||
IMeshData::VectorOfInteger aVertexIndexes(theVertices.Size());
|
||||
|
||||
Standard_Integer anIndex = aLowerIdx;
|
||||
for ( ; anIndex <= anUpperIdx; ++anIndex )
|
||||
{
|
||||
aBox.Add( gp_Pnt2d( theVertices( anIndex ).Coord() ) );
|
||||
aVertexIndexes( anIndex ) = myMeshData->AddNode( theVertices( anIndex ) );
|
||||
aVertexIndexes.Append(myMeshData->AddNode( theVertices( anIndex ) ));
|
||||
}
|
||||
|
||||
perform( aBox, aVertexIndexes );
|
||||
@@ -156,8 +156,8 @@ void BRepMesh_Delaun::Init(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
//function : perform
|
||||
//purpose : Create super mesh and run triangulation procedure
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::perform(Bnd_Box2d& theBndBox,
|
||||
BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
void BRepMesh_Delaun::perform(Bnd_Box2d& theBndBox,
|
||||
IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
{
|
||||
theBndBox.Enlarge( Precision );
|
||||
superMesh( theBndBox );
|
||||
@@ -226,15 +226,15 @@ void BRepMesh_Delaun::superMesh( const Bnd_Box2d& theBox )
|
||||
// edges into the map.
|
||||
// When an edge is suppressed more than one time it is destroyed.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
BRepMesh::MapOfIntegerInteger& theLoopEdges )
|
||||
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
myCircles.Delete( theIndex );
|
||||
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
GetTriangle( theIndex ).Edges( e, o );
|
||||
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(theIndex);
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
const Standard_Boolean(&o)[3] = aElement.myOrientations;
|
||||
|
||||
myMeshData->RemoveElement( theIndex );
|
||||
|
||||
for ( Standard_Integer i = 0; i < 3; ++i )
|
||||
@@ -252,13 +252,11 @@ void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
//purpose : Computes the triangulation and add the vertices edges and
|
||||
// triangles to the Mesh data structure
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::compute(BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
{
|
||||
// Insertion of edges of super triangles in the list of free edges:
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
mySupTrian.Edges( e, o );
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
|
||||
const Standard_Integer(&e)[3] = mySupTrian.myEdges;
|
||||
|
||||
aLoopEdges.Bind( e[0], Standard_True );
|
||||
aLoopEdges.Bind( e[1], Standard_True );
|
||||
@@ -280,13 +278,13 @@ void BRepMesh_Delaun::compute(BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
|
||||
|
||||
aLoopEdges.Clear();
|
||||
BRepMesh::MapOfInteger::Iterator aFreeTriangles( aSelector.Elements() );
|
||||
IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
|
||||
for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
|
||||
deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
|
||||
|
||||
// All edges that remain free are removed from aLoopEdges;
|
||||
// only the boundary edges of the triangulation remain there
|
||||
BRepMesh::MapOfIntegerInteger::Iterator aFreeEdges( aLoopEdges );
|
||||
IMeshData::MapOfIntegerInteger::Iterator aFreeEdges( aLoopEdges );
|
||||
for ( ; aFreeEdges.More(); aFreeEdges.Next() )
|
||||
{
|
||||
if ( myMeshData->ElementsConnectedTo( aFreeEdges.Key() ).IsEmpty() )
|
||||
@@ -302,19 +300,19 @@ void BRepMesh_Delaun::compute(BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
//function : createTriangles
|
||||
//purpose : Creates the triangles beetween the node and the polyline.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
|
||||
BRepMesh::MapOfIntegerInteger& thePoly)
|
||||
void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
|
||||
IMeshData::MapOfIntegerInteger& thePoly)
|
||||
{
|
||||
BRepMesh::ListOfInteger aLoopEdges, anExternalEdges;
|
||||
IMeshData::ListOfInteger aLoopEdges, anExternalEdges;
|
||||
const gp_XY& aVertexCoord = myMeshData->GetNode( theVertexIndex ).Coord();
|
||||
|
||||
BRepMesh::MapOfIntegerInteger::Iterator anEdges( thePoly );
|
||||
IMeshData::MapOfIntegerInteger::Iterator anEdges( thePoly );
|
||||
for ( ; anEdges.More(); anEdges.Next() )
|
||||
{
|
||||
Standard_Integer anEdgeId = anEdges.Key();
|
||||
const BRepMesh_Edge& anEdge = GetEdge( anEdgeId );
|
||||
|
||||
const Standard_Boolean isPositive = thePoly (anEdgeId) != 0;
|
||||
Standard_Boolean isPositive = thePoly( anEdgeId ) != 0;
|
||||
|
||||
Standard_Integer aNodes[3];
|
||||
if ( isPositive )
|
||||
@@ -424,10 +422,10 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIn
|
||||
//purpose : Creation of triangles from the new nodes
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
BRepMesh::Array1OfInteger& theVertexIndexes)
|
||||
IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
{
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
Standard_Real aTolU, aTolV;
|
||||
myMeshData->Data()->GetTolerance(aTolU, aTolV);
|
||||
@@ -441,16 +439,16 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
for( ; anIndex <= anUpper; ++anIndex )
|
||||
{
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
|
||||
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
|
||||
|
||||
// Iterator in the list of indexes of circles containing the node
|
||||
BRepMesh::ListOfInteger& aCirclesList = myCircles.Select( aVertex.Coord() );
|
||||
IMeshData::ListOfInteger& aCirclesList = myCircles.Select( aVertex.Coord() );
|
||||
|
||||
Standard_Integer onEgdeId = 0, aTriangleId = 0;
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt( aCirclesList );
|
||||
IMeshData::ListOfInteger::Iterator aCircleIt( aCirclesList );
|
||||
for ( ; aCircleIt.More(); aCircleIt.Next() )
|
||||
{
|
||||
// To add a node in the mesh it is necessary to check conditions:
|
||||
@@ -484,12 +482,11 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
while ( isModify && !aCirclesList.IsEmpty() )
|
||||
{
|
||||
isModify = Standard_False;
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt1( aCirclesList );
|
||||
IMeshData::ListOfInteger::Iterator aCircleIt1( aCirclesList );
|
||||
for ( ; aCircleIt1.More(); aCircleIt1.Next() )
|
||||
{
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
GetTriangle( aCircleIt1.Value() ).Edges( e, o );
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aCircleIt1.Value());
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
|
||||
if ( aLoopEdges.IsBound( e[0] ) ||
|
||||
aLoopEdges.IsBound( e[1] ) ||
|
||||
@@ -521,13 +518,11 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::insertInternalEdges()
|
||||
{
|
||||
BRepMesh::HMapOfInteger anInternalEdges = InternalEdges();
|
||||
Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();;
|
||||
|
||||
// Destruction of triancles intersecting internal edges
|
||||
// and their replacement by makeshift triangles
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
BRepMesh::MapOfInteger::Iterator anInernalEdgesIt( *anInternalEdges );
|
||||
IMeshData::IteratorOfMapOfInteger anInernalEdgesIt( *anInternalEdges );
|
||||
for ( ; anInernalEdgesIt.More(); anInernalEdgesIt.Next() )
|
||||
{
|
||||
const Standard_Integer aLinkIndex = anInernalEdgesIt.Key();
|
||||
@@ -537,7 +532,10 @@ void BRepMesh_Delaun::insertInternalEdges()
|
||||
Standard_Boolean isGo[2] = { Standard_True, Standard_True };
|
||||
for (Standard_Integer aTriangleIt = 1; aTriangleIt <= aPair.Extent(); ++aTriangleIt)
|
||||
{
|
||||
GetTriangle(aPair.Index(aTriangleIt)).Edges(e, o);
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aPair.Index(aTriangleIt));
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
const Standard_Boolean(&o)[3] = aElement.myOrientations;
|
||||
|
||||
for (Standard_Integer i = 0; i < 3; ++i)
|
||||
{
|
||||
if (e[i] == aLinkIndex)
|
||||
@@ -586,9 +584,8 @@ Standard_Boolean BRepMesh_Delaun::isBoundToFrontier(
|
||||
if ( aTriId < 0 || aTriId == thePrevElementId )
|
||||
continue;
|
||||
|
||||
Standard_Integer anEdges[3];
|
||||
Standard_Boolean anEdgesOri[3];
|
||||
GetTriangle( aTriId ).Edges( anEdges, anEdgesOri );
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
|
||||
const Standard_Integer(&anEdges)[3] = aElement.myEdges;
|
||||
|
||||
for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
|
||||
{
|
||||
@@ -623,16 +620,16 @@ Standard_Boolean BRepMesh_Delaun::isBoundToFrontier(
|
||||
void BRepMesh_Delaun::cleanupMesh()
|
||||
{
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
IMeshData::MapOfInteger aDelTriangles;
|
||||
|
||||
BRepMesh::HMapOfInteger aFreeEdges = FreeEdges();
|
||||
BRepMesh::MapOfInteger::Iterator aFreeEdgesIt( *aFreeEdges );
|
||||
Handle(IMeshData::MapOfInteger) aFreeEdges = FreeEdges();
|
||||
IMeshData::IteratorOfMapOfInteger aFreeEdgesIt( *aFreeEdges );
|
||||
for ( ; aFreeEdgesIt.More(); aFreeEdgesIt.Next() )
|
||||
{
|
||||
const Standard_Integer& aFreeEdgeId = aFreeEdgesIt.Key();
|
||||
@@ -651,9 +648,8 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
Standard_Integer aTriId = aPair.FirstIndex();
|
||||
|
||||
// Check that the connected triangle is not surrounded by another triangles
|
||||
Standard_Integer anEdges[3];
|
||||
Standard_Boolean anEdgesOri[3];
|
||||
GetTriangle( aTriId ).Edges( anEdges, anEdgesOri );
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
|
||||
const Standard_Integer(&anEdges)[3] = aElement.myEdges;
|
||||
|
||||
Standard_Boolean isCanNotBeRemoved = Standard_True;
|
||||
for ( Standard_Integer aCurEdgeIdx = 0; aCurEdgeIdx < 3; ++aCurEdgeIdx )
|
||||
@@ -694,7 +690,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
|
||||
// Destruction of triangles :
|
||||
Standard_Integer aDeletedTrianglesNb = 0;
|
||||
BRepMesh::MapOfInteger::Iterator aDelTrianglesIt( aDelTriangles );
|
||||
IMeshData::IteratorOfMapOfInteger aDelTrianglesIt( aDelTriangles );
|
||||
for ( ; aDelTrianglesIt.More(); aDelTrianglesIt.Next() )
|
||||
{
|
||||
deleteTriangle( aDelTrianglesIt.Key(), aLoopEdges );
|
||||
@@ -702,7 +698,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
}
|
||||
|
||||
// Destruction of remaining hanging edges
|
||||
BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
|
||||
{
|
||||
if ( myMeshData->ElementsConnectedTo( aLoopEdgesIt.Key() ).IsEmpty() )
|
||||
@@ -720,15 +716,14 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::frontierAdjust()
|
||||
{
|
||||
BRepMesh::HMapOfInteger aFrontier = Frontier();
|
||||
Handle(IMeshData::MapOfInteger) aFrontier = Frontier();
|
||||
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
BRepMesh::VectorOfInteger aFailedFrontiers(256, aAllocator);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::HMapOfInteger aIntFrontierEdges =
|
||||
new BRepMesh::MapOfInteger(10, aAllocator);
|
||||
IMeshData::VectorOfInteger aFailedFrontiers(256, aAllocator);
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
Handle(IMeshData::MapOfInteger) aIntFrontierEdges = new IMeshData::MapOfInteger;
|
||||
|
||||
for ( Standard_Integer aPass = 1; aPass <= 2; ++aPass )
|
||||
{
|
||||
@@ -736,7 +731,7 @@ void BRepMesh_Delaun::frontierAdjust()
|
||||
// 2 pass): find external triangles on boundary edges appeared
|
||||
// during triangles replacement.
|
||||
|
||||
BRepMesh::MapOfInteger::Iterator aFrontierIt( *aFrontier );
|
||||
IMeshData::IteratorOfMapOfInteger aFrontierIt( *aFrontier );
|
||||
for ( ; aFrontierIt.More(); aFrontierIt.Next() )
|
||||
{
|
||||
Standard_Integer aFrontierId = aFrontierIt.Key();
|
||||
@@ -748,9 +743,9 @@ void BRepMesh_Delaun::frontierAdjust()
|
||||
if( aPriorElemId < 0 )
|
||||
continue;
|
||||
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
GetTriangle( aPriorElemId ).Edges( e, o );
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aPriorElemId);
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
const Standard_Boolean(&o)[3] = aElement.myOrientations;
|
||||
|
||||
Standard_Boolean isTriangleFound = Standard_False;
|
||||
for ( Standard_Integer n = 0; n < 3; ++n )
|
||||
@@ -770,7 +765,7 @@ void BRepMesh_Delaun::frontierAdjust()
|
||||
}
|
||||
|
||||
// destrucrion of remaining hanging edges :
|
||||
BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
|
||||
{
|
||||
Standard_Integer aLoopEdgeId = aLoopEdgesIt.Key();
|
||||
@@ -801,7 +796,7 @@ void BRepMesh_Delaun::frontierAdjust()
|
||||
// situation when frontier edge has a triangle at a right side, but its free
|
||||
// links cross another frontieres and meshLeftPolygonOf itself can't collect
|
||||
// a closed polygon.
|
||||
BRepMesh::VectorOfInteger::Iterator aFailedFrontiersIt( aFailedFrontiers );
|
||||
IMeshData::VectorOfInteger::Iterator aFailedFrontiersIt( aFailedFrontiers );
|
||||
for ( ; aFailedFrontiersIt.More(); aFailedFrontiersIt.Next() )
|
||||
{
|
||||
Standard_Integer aFrontierId = aFailedFrontiersIt.Value();
|
||||
@@ -817,9 +812,9 @@ void BRepMesh_Delaun::frontierAdjust()
|
||||
//purpose : Add boundig box for edge defined by start & end point to
|
||||
// the given vector of bounding boxes for triangulation edges
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::fillBndBox(BRepMesh::SequenceOfBndB2d& theBoxes,
|
||||
const BRepMesh_Vertex& theV1,
|
||||
const BRepMesh_Vertex& theV2)
|
||||
void BRepMesh_Delaun::fillBndBox(IMeshData::SequenceOfBndB2d& theBoxes,
|
||||
const BRepMesh_Vertex& theV1,
|
||||
const BRepMesh_Vertex& theV2)
|
||||
{
|
||||
Bnd_B2d aBox;
|
||||
UpdateBndBox(theV1.Coord(), theV2.Coord(), aBox);
|
||||
@@ -831,16 +826,16 @@ void BRepMesh_Delaun::fillBndBox(BRepMesh::SequenceOfBndB2d& theBoxes,
|
||||
//purpose : Collect the polygon at the left of the given edge (material side)
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_Delaun::meshLeftPolygonOf(
|
||||
const Standard_Integer theStartEdgeId,
|
||||
const Standard_Boolean isForward,
|
||||
BRepMesh::HMapOfInteger theSkipped )
|
||||
const Standard_Integer theStartEdgeId,
|
||||
const Standard_Boolean isForward,
|
||||
Handle(IMeshData::MapOfInteger) theSkipped)
|
||||
{
|
||||
if ( !theSkipped.IsNull() && theSkipped->Contains( theStartEdgeId ) )
|
||||
return Standard_True;
|
||||
|
||||
const BRepMesh_Edge& aRefEdge = GetEdge( theStartEdgeId );
|
||||
|
||||
BRepMesh::SequenceOfInteger aPolygon;
|
||||
IMeshData::SequenceOfInteger aPolygon;
|
||||
Standard_Integer aStartNode, aPivotNode;
|
||||
if ( isForward )
|
||||
{
|
||||
@@ -868,14 +863,14 @@ Standard_Boolean BRepMesh_Delaun::meshLeftPolygonOf(
|
||||
// Auxilary structures.
|
||||
// Bounding boxes of polygon links to be used for preliminary
|
||||
// analysis of intersections
|
||||
BRepMesh::SequenceOfBndB2d aBoxes;
|
||||
IMeshData::SequenceOfBndB2d aBoxes;
|
||||
fillBndBox( aBoxes, aStartEdgeVertexS, aPivotVertex );
|
||||
|
||||
// Hanging ends
|
||||
BRepMesh::MapOfInteger aDeadLinks;
|
||||
IMeshData::MapOfInteger aDeadLinks;
|
||||
|
||||
// Links are temporarily excluded from consideration
|
||||
BRepMesh::MapOfInteger aLeprousLinks;
|
||||
IMeshData::MapOfInteger aLeprousLinks;
|
||||
aLeprousLinks.Add( theStartEdgeId );
|
||||
|
||||
Standard_Boolean isSkipLeprous = Standard_True;
|
||||
@@ -960,26 +955,26 @@ Standard_Boolean BRepMesh_Delaun::meshLeftPolygonOf(
|
||||
// consideration next time until a hanging end is occured.
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_Delaun::findNextPolygonLink(
|
||||
const Standard_Integer& theFirstNode,
|
||||
const Standard_Integer& thePivotNode,
|
||||
const BRepMesh_Vertex& thePivotVertex,
|
||||
const gp_Vec2d& theRefLinkDir,
|
||||
const BRepMesh::SequenceOfBndB2d& theBoxes,
|
||||
const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::HMapOfInteger theSkipped,
|
||||
const Standard_Boolean& isSkipLeprous,
|
||||
BRepMesh::MapOfInteger& theLeprousLinks,
|
||||
BRepMesh::MapOfInteger& theDeadLinks,
|
||||
Standard_Integer& theNextPivotNode,
|
||||
gp_Vec2d& theNextLinkDir,
|
||||
Bnd_B2d& theNextLinkBndBox )
|
||||
const Standard_Integer& theFirstNode,
|
||||
const Standard_Integer& thePivotNode,
|
||||
const BRepMesh_Vertex& thePivotVertex,
|
||||
const gp_Vec2d& theRefLinkDir,
|
||||
const IMeshData::SequenceOfBndB2d& theBoxes,
|
||||
const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const Handle(IMeshData::MapOfInteger) theSkipped,
|
||||
const Standard_Boolean& isSkipLeprous,
|
||||
IMeshData::MapOfInteger& theLeprousLinks,
|
||||
IMeshData::MapOfInteger& theDeadLinks,
|
||||
Standard_Integer& theNextPivotNode,
|
||||
gp_Vec2d& theNextLinkDir,
|
||||
Bnd_B2d& theNextLinkBndBox )
|
||||
{
|
||||
// Find the next link having the greatest angle
|
||||
// respect to a direction of a reference one
|
||||
Standard_Real aMaxAngle = RealFirst();
|
||||
|
||||
Standard_Integer aNextLinkId = 0;
|
||||
BRepMesh::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( thePivotNode ) );
|
||||
IMeshData::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( thePivotNode ) );
|
||||
for ( ; aLinkIt.More(); aLinkIt.Next() )
|
||||
{
|
||||
const Standard_Integer& aNeighbourLinkInfo = aLinkIt.Value();
|
||||
@@ -1069,13 +1064,13 @@ Standard_Integer BRepMesh_Delaun::findNextPolygonLink(
|
||||
// <theLinkBndBox> parameter.
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_Delaun::checkIntersection(
|
||||
const BRepMesh_Edge& theLink,
|
||||
const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
const Standard_Boolean isConsiderEndPointTouch,
|
||||
const Standard_Boolean isConsiderPointOnEdge,
|
||||
const Standard_Boolean isSkipLastEdge,
|
||||
Bnd_B2d& theLinkBndBox ) const
|
||||
const BRepMesh_Edge& theLink,
|
||||
const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const IMeshData::SequenceOfBndB2d& thePolyBoxes,
|
||||
const Standard_Boolean isConsiderEndPointTouch,
|
||||
const Standard_Boolean isConsiderPointOnEdge,
|
||||
const Standard_Boolean isSkipLastEdge,
|
||||
Bnd_B2d& theLinkBndBox ) const
|
||||
{
|
||||
UpdateBndBox(GetVertex(theLink.FirstNode()).Coord(),
|
||||
GetVertex(theLink.LastNode()).Coord(), theLinkBndBox);
|
||||
@@ -1101,7 +1096,7 @@ Standard_Boolean BRepMesh_Delaun::checkIntersection(
|
||||
continue;
|
||||
|
||||
gp_Pnt2d anIntPnt;
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( theLink, aPolyLink,
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( theLink, aPolyLink,
|
||||
isConsiderEndPointTouch, isConsiderPointOnEdge, anIntPnt );
|
||||
|
||||
if ( aIntFlag != BRepMesh_GeomTool::NoIntersection )
|
||||
@@ -1117,17 +1112,10 @@ Standard_Boolean BRepMesh_Delaun::checkIntersection(
|
||||
//function : addTriangle
|
||||
//purpose : Add a triangle based on the given oriented edges into mesh
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3])
|
||||
inline void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3] )
|
||||
{
|
||||
for (Standard_Integer i = 0; i < 3; ++i)
|
||||
{
|
||||
const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo(theEdgesId[i]);
|
||||
if (aPair.Extent() == 2)
|
||||
// it is forbidden to have more than two triangles connected to the same link
|
||||
return;
|
||||
}
|
||||
Standard_Integer aNewTriangleId =
|
||||
myMeshData->AddElement(BRepMesh_Triangle(theEdgesId,
|
||||
theEdgesOri, BRepMesh_Free));
|
||||
@@ -1146,20 +1134,20 @@ void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
|
||||
//function : cleanupPolygon
|
||||
//purpose : Remove internal triangles from the given polygon
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::SequenceOfBndB2d& thePolyBoxes )
|
||||
void BRepMesh_Delaun::cleanupPolygon(const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const IMeshData::SequenceOfBndB2d& thePolyBoxes )
|
||||
{
|
||||
Standard_Integer aPolyLen = thePolygon.Length();
|
||||
if ( aPolyLen < 3 )
|
||||
return;
|
||||
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger anIgnoredEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aPolyVerticesFindMap(10, aAllocator);
|
||||
BRepMesh::VectorOfInteger aPolyVertices(256, aAllocator);
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
IMeshData::MapOfInteger anIgnoredEdges;
|
||||
IMeshData::MapOfInteger aPolyVerticesFindMap;
|
||||
IMeshData::VectorOfInteger aPolyVertices(256, aAllocator);
|
||||
// Collect boundary vertices of the polygon
|
||||
for ( Standard_Integer aPolyIt = 1; aPolyIt <= aPolyLen; ++aPolyIt )
|
||||
{
|
||||
@@ -1178,9 +1166,9 @@ void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolyg
|
||||
if ( anElemId < 0 )
|
||||
continue;
|
||||
|
||||
Standard_Integer anEdges[3];
|
||||
Standard_Boolean anEdgesOri[3];
|
||||
GetTriangle( anElemId ).Edges(anEdges, anEdgesOri);
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(anElemId);
|
||||
const Standard_Integer(&anEdges)[3] = aElement.myEdges;
|
||||
const Standard_Boolean(&anEdgesOri)[3] = aElement.myOrientations;
|
||||
|
||||
Standard_Integer isTriangleFound = Standard_False;
|
||||
for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
|
||||
@@ -1225,7 +1213,7 @@ void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolyg
|
||||
if ( aPolyVertices.First() != aPolyVertices.Last() )
|
||||
aPolyVertices.Append( aPolyVertices.First() );
|
||||
|
||||
BRepMesh::MapOfInteger aSurvivedLinks( anIgnoredEdges );
|
||||
IMeshData::MapOfInteger aSurvivedLinks( anIgnoredEdges );
|
||||
|
||||
Standard_Integer aPolyVertIt = 0;
|
||||
Standard_Integer anUniqueVerticesNum = aPolyVertices.Length() - 1;
|
||||
@@ -1236,7 +1224,7 @@ void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolyg
|
||||
thePolyBoxes, aSurvivedLinks, aLoopEdges );
|
||||
}
|
||||
|
||||
BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
|
||||
{
|
||||
const Standard_Integer& aLoopEdgeId = aLoopEdgesIt.Key();
|
||||
@@ -1254,19 +1242,19 @@ void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolyg
|
||||
// inside the polygon or crossed it.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::killTrianglesAroundVertex(
|
||||
const Standard_Integer theZombieNodeId,
|
||||
const BRepMesh::VectorOfInteger& thePolyVertices,
|
||||
const BRepMesh::MapOfInteger& thePolyVerticesFindMap,
|
||||
const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::MapOfInteger& theSurvivedLinks,
|
||||
BRepMesh::MapOfIntegerInteger& theLoopEdges )
|
||||
const Standard_Integer theZombieNodeId,
|
||||
const IMeshData::VectorOfInteger& thePolyVertices,
|
||||
const IMeshData::MapOfInteger& thePolyVerticesFindMap,
|
||||
const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const IMeshData::SequenceOfBndB2d& thePolyBoxes,
|
||||
IMeshData::MapOfInteger& theSurvivedLinks,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
BRepMesh::ListOfInteger::Iterator aNeighborsIt =
|
||||
IMeshData::ListOfInteger::Iterator aNeighborsIt =
|
||||
myMeshData->LinksConnectedTo( theZombieNodeId );
|
||||
|
||||
// Try to infect neighbor nodes
|
||||
BRepMesh::VectorOfInteger aVictimNodes;
|
||||
IMeshData::VectorOfInteger aVictimNodes;
|
||||
for ( ; aNeighborsIt.More(); aNeighborsIt.Next() )
|
||||
{
|
||||
const Standard_Integer& aNeighborLinkId = aNeighborsIt.Value();
|
||||
@@ -1324,7 +1312,7 @@ void BRepMesh_Delaun::killTrianglesAroundVertex(
|
||||
}
|
||||
|
||||
// Go and do your job!
|
||||
BRepMesh::VectorOfInteger::Iterator aVictimIt( aVictimNodes );
|
||||
IMeshData::VectorOfInteger::Iterator aVictimIt( aVictimNodes );
|
||||
for ( ; aVictimIt.More(); aVictimIt.Next() )
|
||||
{
|
||||
killTrianglesAroundVertex( aVictimIt.Value(), thePolyVertices,
|
||||
@@ -1338,8 +1326,8 @@ void BRepMesh_Delaun::killTrianglesAroundVertex(
|
||||
//purpose : Checks is the given vertex lies inside the polygon
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_Delaun::isVertexInsidePolygon(
|
||||
const Standard_Integer& theVertexId,
|
||||
const BRepMesh::VectorOfInteger& thePolygonVertices ) const
|
||||
const Standard_Integer& theVertexId,
|
||||
const IMeshData::VectorOfInteger& thePolygonVertices ) const
|
||||
{
|
||||
Standard_Integer aPolyLen = thePolygonVertices.Length();
|
||||
if ( aPolyLen < 3 )
|
||||
@@ -1379,13 +1367,13 @@ Standard_Boolean BRepMesh_Delaun::isVertexInsidePolygon(
|
||||
// boundary intersection. Does nothing elsewhere.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::killTrianglesOnIntersectingLinks(
|
||||
const Standard_Integer& theLinkToCheckId,
|
||||
const BRepMesh_Edge& theLinkToCheck,
|
||||
const Standard_Integer& theEndPoint,
|
||||
const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::MapOfInteger& theSurvivedLinks,
|
||||
BRepMesh::MapOfIntegerInteger& theLoopEdges )
|
||||
const Standard_Integer& theLinkToCheckId,
|
||||
const BRepMesh_Edge& theLinkToCheck,
|
||||
const Standard_Integer& theEndPoint,
|
||||
const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const IMeshData::SequenceOfBndB2d& thePolyBoxes,
|
||||
IMeshData::MapOfInteger& theSurvivedLinks,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
if ( theSurvivedLinks.Contains( theLinkToCheckId ) )
|
||||
return;
|
||||
@@ -1403,7 +1391,7 @@ void BRepMesh_Delaun::killTrianglesOnIntersectingLinks(
|
||||
|
||||
killLinkTriangles( theLinkToCheckId, theLoopEdges );
|
||||
|
||||
BRepMesh::ListOfInteger::Iterator aNeighborsIt(
|
||||
IMeshData::ListOfInteger::Iterator aNeighborsIt(
|
||||
myMeshData->LinksConnectedTo(theEndPoint));
|
||||
|
||||
for ( ; aNeighborsIt.More(); aNeighborsIt.Next() )
|
||||
@@ -1425,8 +1413,8 @@ void BRepMesh_Delaun::killTrianglesOnIntersectingLinks(
|
||||
//purpose : Kill triangles bound to the given link.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::killLinkTriangles(
|
||||
const Standard_Integer& theLinkId,
|
||||
BRepMesh::MapOfIntegerInteger& theLoopEdges )
|
||||
const Standard_Integer& theLinkId,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
const BRepMesh_PairOfIndex& aPair =
|
||||
myMeshData->ElementsConnectedTo( theLinkId );
|
||||
@@ -1468,17 +1456,17 @@ void BRepMesh_Delaun::getOrientedNodes(const BRepMesh_Edge& theEdge,
|
||||
//purpose : Processes loop within the given polygon formed by range of
|
||||
// its links specified by start and end link indices.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::processLoop(const Standard_Integer theLinkFrom,
|
||||
const Standard_Integer theLinkTo,
|
||||
const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const BRepMesh::SequenceOfBndB2d& thePolyBoxes)
|
||||
void BRepMesh_Delaun::processLoop(const Standard_Integer theLinkFrom,
|
||||
const Standard_Integer theLinkTo,
|
||||
const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const IMeshData::SequenceOfBndB2d& thePolyBoxes)
|
||||
{
|
||||
Standard_Integer aNbOfLinksInLoop = theLinkTo - theLinkFrom - 1;
|
||||
if ( aNbOfLinksInLoop < 3 )
|
||||
return;
|
||||
|
||||
BRepMesh::SequenceOfInteger aPolygon;
|
||||
BRepMesh::SequenceOfBndB2d aPolyBoxes;
|
||||
IMeshData::SequenceOfInteger aPolygon;
|
||||
IMeshData::SequenceOfBndB2d aPolyBoxes;
|
||||
for ( ; aNbOfLinksInLoop > 0; --aNbOfLinksInLoop )
|
||||
{
|
||||
Standard_Integer aLoopLinkIndex = theLinkFrom + aNbOfLinksInLoop;
|
||||
@@ -1496,10 +1484,10 @@ void BRepMesh_Delaun::processLoop(const Standard_Integer theLinkFrom
|
||||
Standard_Integer BRepMesh_Delaun::createAndReplacePolygonLink(
|
||||
const Standard_Integer *theNodes,
|
||||
const gp_Pnt2d *thePnts,
|
||||
const Standard_Integer theRootIndex,
|
||||
const ReplaceFlag theReplaceFlag,
|
||||
BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes )
|
||||
const Standard_Integer theRootIndex,
|
||||
const ReplaceFlag theReplaceFlag,
|
||||
IMeshData::SequenceOfInteger& thePolygon,
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxes )
|
||||
{
|
||||
Standard_Integer aNewEdgeId =
|
||||
myMeshData->AddLink( BRepMesh_Edge(
|
||||
@@ -1533,9 +1521,9 @@ Standard_Integer BRepMesh_Delaun::createAndReplacePolygonLink(
|
||||
//function : meshPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::HMapOfInteger theSkipped )
|
||||
void BRepMesh_Delaun::meshPolygon(IMeshData::SequenceOfInteger& thePolygon,
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxes,
|
||||
Handle(IMeshData::MapOfInteger) theSkipped)
|
||||
{
|
||||
// Check is the source polygon elementary
|
||||
if ( meshElementaryPolygon( thePolygon ) )
|
||||
@@ -1582,7 +1570,7 @@ void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
};
|
||||
|
||||
gp_Pnt2d anIntPnt;
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( *aCurEdge, *aNextEdge,
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( *aCurEdge, *aNextEdge,
|
||||
Standard_False, Standard_True, anIntPnt );
|
||||
|
||||
if ( aIntFlag == BRepMesh_GeomTool::NoIntersection )
|
||||
@@ -1749,14 +1737,14 @@ void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
}
|
||||
}
|
||||
|
||||
BRepMesh::SequenceOfInteger* aPolygon1 = &thePolygon;
|
||||
BRepMesh::SequenceOfBndB2d* aPolyBoxes1 = &thePolyBoxes;
|
||||
IMeshData::SequenceOfInteger* aPolygon1 = &thePolygon;
|
||||
IMeshData::SequenceOfBndB2d* aPolyBoxes1 = &thePolyBoxes;
|
||||
|
||||
BRepMesh::HSequenceOfInteger aPolygon2 = new BRepMesh::SequenceOfInteger;
|
||||
BRepMesh::HSequenceOfBndB2d aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
|
||||
Handle(IMeshData::SequenceOfInteger) aPolygon2 = new IMeshData::SequenceOfInteger;
|
||||
Handle(IMeshData::SequenceOfBndB2d) aPolyBoxes2 = new IMeshData::SequenceOfBndB2d;
|
||||
|
||||
NCollection_Sequence<BRepMesh::HSequenceOfInteger> aPolyStack;
|
||||
NCollection_Sequence<BRepMesh::HSequenceOfBndB2d> aPolyBoxStack;
|
||||
NCollection_Sequence<Handle(IMeshData::SequenceOfInteger)> aPolyStack;
|
||||
NCollection_Sequence<Handle(IMeshData::SequenceOfBndB2d)> aPolyBoxStack;
|
||||
for (;;)
|
||||
{
|
||||
decomposeSimplePolygon(*aPolygon1, *aPolyBoxes1, *aPolygon2, *aPolyBoxes2);
|
||||
@@ -1765,8 +1753,8 @@ void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
aPolyStack.Append(aPolygon2);
|
||||
aPolyBoxStack.Append(aPolyBoxes2);
|
||||
|
||||
aPolygon2 = new BRepMesh::SequenceOfInteger;
|
||||
aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
|
||||
aPolygon2 = new IMeshData::SequenceOfInteger;
|
||||
aPolyBoxes2 = new IMeshData::SequenceOfBndB2d;
|
||||
}
|
||||
|
||||
if (aPolygon1->IsEmpty())
|
||||
@@ -1791,7 +1779,7 @@ void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
|
||||
//purpose : Triangulation of closed polygon containing only three edges.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
|
||||
const BRepMesh::SequenceOfInteger& thePolygon)
|
||||
const IMeshData::SequenceOfInteger& thePolygon)
|
||||
{
|
||||
Standard_Integer aPolyLen = thePolygon.Length();
|
||||
if ( aPolyLen < 3 )
|
||||
@@ -1831,10 +1819,10 @@ inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::decomposeSimplePolygon(
|
||||
BRepMesh::SequenceOfInteger& thePolygon,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxes,
|
||||
BRepMesh::SequenceOfInteger& thePolygonCut,
|
||||
BRepMesh::SequenceOfBndB2d& thePolyBoxesCut)
|
||||
IMeshData::SequenceOfInteger& thePolygon,
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxes,
|
||||
IMeshData::SequenceOfInteger& thePolygonCut,
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxesCut)
|
||||
{
|
||||
// Check is the given polygon elementary
|
||||
if ( meshElementaryPolygon( thePolygon ) )
|
||||
@@ -1926,7 +1914,7 @@ void BRepMesh_Delaun::decomposeSimplePolygon(
|
||||
|
||||
// intersection is possible...
|
||||
gp_Pnt2d anIntPnt;
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( aCheckLink, aPolyLink,
|
||||
BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( aCheckLink, aPolyLink,
|
||||
Standard_False, Standard_False, anIntPnt );
|
||||
|
||||
if( aIntFlag != BRepMesh_GeomTool::NoIntersection )
|
||||
@@ -2018,17 +2006,17 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
|
||||
aSelector.NeighboursOf( theVertex );
|
||||
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges;//( 10, myMeshData->Allocator() );
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges;//( 10, myMeshData->Allocator() );
|
||||
|
||||
// Loop on triangles to be destroyed :
|
||||
BRepMesh::MapOfInteger::Iterator aTriangleIt( aSelector.Elements() );
|
||||
IMeshData::IteratorOfMapOfInteger aTriangleIt( aSelector.Elements() );
|
||||
for ( ; aTriangleIt.More(); aTriangleIt.Next() )
|
||||
deleteTriangle( aTriangleIt.Key(), aLoopEdges );
|
||||
|
||||
BRepMesh::SequenceOfBndB2d aBoxes;
|
||||
BRepMesh::SequenceOfInteger aPolygon;
|
||||
IMeshData::SequenceOfBndB2d aBoxes;
|
||||
IMeshData::SequenceOfInteger aPolygon;
|
||||
Standard_Integer aLoopEdgesCount = aLoopEdges.Extent();
|
||||
BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
|
||||
|
||||
if ( aLoopEdgesIt.More() )
|
||||
{
|
||||
@@ -2038,7 +2026,7 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
Standard_Integer aPivotNode = anEdge.LastNode();
|
||||
Standard_Integer anEdgeId = aLoopEdgesIt.Key();
|
||||
|
||||
Standard_Boolean isPositive = (aLoopEdges (anEdgeId) != 0);
|
||||
Standard_Boolean isPositive = aLoopEdges( anEdgeId ) != 0;
|
||||
if ( !isPositive )
|
||||
{
|
||||
Standard_Integer aTmp;
|
||||
@@ -2058,7 +2046,7 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
aLastNode = aFirstNode;
|
||||
while ( aPivotNode != aLastNode )
|
||||
{
|
||||
BRepMesh::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( aPivotNode ) );
|
||||
IMeshData::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( aPivotNode ) );
|
||||
for ( ; aLinkIt.More(); aLinkIt.Next() )
|
||||
{
|
||||
if ( aLinkIt.Value() != anEdgeId &&
|
||||
@@ -2099,19 +2087,13 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
//function : AddVertices
|
||||
//purpose : Adds some vertices in the triangulation.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices)
|
||||
void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices)
|
||||
{
|
||||
std::make_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
|
||||
std::sort_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
|
||||
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
|
||||
std::make_heap(theVertices.begin(), theVertices.end(), aCmp);
|
||||
std::sort_heap(theVertices.begin(), theVertices.end(), aCmp);
|
||||
|
||||
Standard_Integer aLower = theVertices.Lower();
|
||||
Standard_Integer anUpper = theVertices.Upper();
|
||||
|
||||
BRepMesh::Array1OfInteger aVertexIndexes( aLower, anUpper );
|
||||
for ( Standard_Integer i = aLower; i <= anUpper; ++i )
|
||||
aVertexIndexes(i) = myMeshData->AddNode( theVertices(i) );
|
||||
|
||||
createTrianglesOnNewVertices( aVertexIndexes );
|
||||
createTrianglesOnNewVertices(theVertices);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2206,12 +2188,12 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
|
||||
//function : getEdgesByType
|
||||
//purpose : Gives the list of edges with type defined by input parameter
|
||||
//=======================================================================
|
||||
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
||||
Handle(IMeshData::MapOfInteger) BRepMesh_Delaun::getEdgesByType(
|
||||
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
||||
{
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
|
||||
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
||||
Handle(IMeshData::MapOfInteger) aResult = new IMeshData::MapOfInteger;
|
||||
IMeshData::IteratorOfMapOfInteger anEdgeIt( myMeshData->LinksOfDomain() );
|
||||
|
||||
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
||||
{
|
||||
@@ -2274,12 +2256,10 @@ Standard_Boolean BRepMesh_Delaun::Contains( const Standard_Integer theTriangleId
|
||||
{
|
||||
theEdgeOn = 0;
|
||||
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
Standard_Integer p[3];
|
||||
|
||||
const BRepMesh_Triangle& aElement = GetTriangle( theTriangleId );
|
||||
aElement.Edges(e, o);
|
||||
const Standard_Integer(&e)[3] = aElement.myEdges;
|
||||
|
||||
const BRepMesh_Edge* anEdges[3] = { &GetEdge( e[0] ),
|
||||
&GetEdge( e[1] ),
|
||||
@@ -2329,7 +2309,7 @@ Standard_Boolean BRepMesh_Delaun::Contains( const Standard_Integer theTriangleId
|
||||
//function : intSegSeg
|
||||
//purpose : Checks intersection between the two segments.
|
||||
//=============================================================================
|
||||
BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
|
||||
BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
|
||||
const BRepMesh_Edge& theEdg1,
|
||||
const BRepMesh_Edge& theEdg2,
|
||||
const Standard_Boolean isConsiderEndPointTouch,
|
||||
@@ -2351,9 +2331,9 @@ BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
|
||||
//purpose : Returns area of the loop of the given polygon defined by indices
|
||||
// of its start and end links.
|
||||
//=============================================================================
|
||||
Standard_Real BRepMesh_Delaun::polyArea(const BRepMesh::SequenceOfInteger& thePolygon,
|
||||
const Standard_Integer theStartIndex,
|
||||
const Standard_Integer theEndIndex) const
|
||||
Standard_Real BRepMesh_Delaun::polyArea(const IMeshData::SequenceOfInteger& thePolygon,
|
||||
const Standard_Integer theStartIndex,
|
||||
const Standard_Integer theEndIndex) const
|
||||
{
|
||||
Standard_Real aArea = 0.0;
|
||||
Standard_Integer aPolyLen = thePolygon.Length();
|
||||
@@ -2406,9 +2386,9 @@ Standard_CString BRepMesh_DumpPoly(void* thePolygon,
|
||||
return "Error: file name or polygon data is null";
|
||||
}
|
||||
|
||||
BRepMesh::SequenceOfInteger& aPolygon = *(BRepMesh::SequenceOfInteger*)thePolygon;
|
||||
IMeshData::SequenceOfInteger& aPolygon = *(IMeshData::SequenceOfInteger*)thePolygon;
|
||||
|
||||
Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
|
||||
Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
|
||||
*(Handle(BRepMesh_DataStructureOfDelaun)*)theMeshHandlePtr;
|
||||
|
||||
if (aMeshData.IsNull())
|
||||
@@ -2422,7 +2402,7 @@ Standard_CString BRepMesh_DumpPoly(void* thePolygon,
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
BRepMesh::SequenceOfInteger::Iterator aLinksIt(aPolygon);
|
||||
IMeshData::SequenceOfInteger::Iterator aLinksIt(aPolygon);
|
||||
for (; aLinksIt.More(); aLinksIt.Next())
|
||||
{
|
||||
const BRepMesh_Edge& aLink = aMeshData->GetLink(Abs(aLinksIt.Value()));
|
||||
|
Reference in New Issue
Block a user