mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0021858: Visualization hangs on attached face
This commit is contained in:
parent
3d4fe6dafc
commit
51c3cc5f78
@ -75,6 +75,9 @@ is enumeration DegreeOfFreedom is
|
||||
imported PairOfIndex from BRepMesh;
|
||||
imported CircleInspector from BRepMesh;
|
||||
imported CellFilter from BRepMesh;
|
||||
imported VertexInspector from BRepMesh;
|
||||
imported VertexCellFilter from BRepMesh;
|
||||
imported VectorOfVertex from BRepMesh;
|
||||
|
||||
class ComparatorOfVertexOfDelaun;
|
||||
class ComparatorOfIndexedVertexOfDelaun;
|
||||
@ -82,7 +85,8 @@ is enumeration DegreeOfFreedom is
|
||||
class Delaun;
|
||||
class DataStructureOfDelaun;
|
||||
class CircleTool;
|
||||
|
||||
class VertexTool;
|
||||
|
||||
class Array1OfVertexOfDelaun instantiates Array1 from TCollection
|
||||
(Vertex from BRepMesh);
|
||||
|
||||
@ -104,6 +108,9 @@ is enumeration DegreeOfFreedom is
|
||||
class ElemHasherOfDataStructureOfDelaun instantiates MapHasher from TCollection
|
||||
(Triangle from BRepMesh);
|
||||
|
||||
class DataMapOfIntegerListOfInteger instantiates DataMap from TCollection
|
||||
(Integer from Standard, ListOfInteger from BRepMesh, MapIntegerHasher from TColStd);
|
||||
|
||||
class IDMapOfNodeOfDataStructureOfDelaun instantiates IndexedDataMap from TCollection
|
||||
(Vertex from BRepMesh,
|
||||
ListOfInteger from BRepMesh,
|
||||
|
@ -22,7 +22,7 @@ class DataStructureOfDelaun from BRepMesh inherits TShared from MMgt
|
||||
NodeHasherOfDataStructureOfDelaun from BRepMesh,
|
||||
LinkHasherOfDataStructureOfDelaun from BRepMesh,
|
||||
ElemHasherOfDataStructureOfDelaun from BRepMesh,
|
||||
IDMapOfNodeOfDataStructureOfDelaun from BRepMesh,
|
||||
VertexTool from BRepMesh,
|
||||
IDMapOfLinkOfDataStructureOfDelaun from BRepMesh,
|
||||
IMapOfElementOfDataStructureOfDelaun from BRepMesh,
|
||||
SelectorOfDataStructureOfDelaun from BRepMesh,
|
||||
@ -32,173 +32,171 @@ class DataStructureOfDelaun from BRepMesh inherits TShared from MMgt
|
||||
|
||||
is Create (theAllocator: BaseAllocator from BRepMesh;
|
||||
NodeNumber : Integer from Standard = 100)
|
||||
---Purpose: <NodeNumber> is just an evaluation of the
|
||||
-- presumed number of nodes in this mesh. The
|
||||
-- Mesh data structure will be automatically
|
||||
-- redimensioned if necessary.
|
||||
returns mutable DataStructureOfDelaun from BRepMesh ;
|
||||
---Purpose: <NodeNumber> is just an evaluation of the
|
||||
-- presumed number of nodes in this mesh. The
|
||||
-- Mesh data structure will be automatically
|
||||
-- redimensioned if necessary.
|
||||
returns mutable DataStructureOfDelaun from BRepMesh ;
|
||||
|
||||
AddNode (me : mutable ;
|
||||
AddNode (me : mutable ;
|
||||
theNode : Vertex from BRepMesh)
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds a node to the mesh if the node is not
|
||||
-- already in the Mesh. Returns the index of the
|
||||
-- node in the structure.
|
||||
is static;
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds a node to the mesh if the node is not
|
||||
-- already in the Mesh. Returns the index of the
|
||||
-- node in the structure.
|
||||
is static;
|
||||
|
||||
GetNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns Vertex from BRepMesh
|
||||
---Purpose: Get the value of node <Index>.
|
||||
---C++: return const &
|
||||
---C++: alias operator ()
|
||||
is static;
|
||||
|
||||
GetNodeList (me : mutable;
|
||||
GetNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns ListOfInteger from BRepMesh
|
||||
---Purpose: Get the list of node <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
returns Vertex from BRepMesh
|
||||
---Purpose: Get the value of node <Index>.
|
||||
---C++: return const &
|
||||
---C++: alias operator ()
|
||||
is static;
|
||||
|
||||
ForceRemoveNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the node of index <index> from the mesh.
|
||||
is static;
|
||||
GetNodeList (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns ListOfInteger from BRepMesh
|
||||
---Purpose: Get the list of node <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
ForceRemoveLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the link of index <index> from the mesh.
|
||||
is static;
|
||||
ForceRemoveNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the node of index <index> from the mesh.
|
||||
is static;
|
||||
|
||||
ReplaceNodes (me : mutable;
|
||||
NewNodes : IDMapOfNodeOfDataStructureOfDelaun from BRepMesh)
|
||||
---Purpose: Removes the all nodes and sets new map of
|
||||
-- nodes from the mesh.
|
||||
-- For internal use only.
|
||||
is static;
|
||||
ForceRemoveLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the link of index <index> from the mesh.
|
||||
is static;
|
||||
|
||||
RemoveNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the node of index <index> from the mesh.
|
||||
is static;
|
||||
ReplaceNodes (me : mutable;
|
||||
NewNodes : VertexTool from BRepMesh)
|
||||
---Purpose: Removes the all nodes and sets new map of
|
||||
-- nodes from the mesh.
|
||||
-- For internal use only.
|
||||
is static;
|
||||
|
||||
MoveNode (me : mutable ;
|
||||
Index : Integer from Standard;
|
||||
newNode : Vertex from BRepMesh)
|
||||
---Purpose: Changes the UV value of node of index <Index> by
|
||||
-- <newNode>. Returns false if <newnode> is already in
|
||||
-- the structure.
|
||||
returns Boolean from Standard is static;
|
||||
RemoveNode (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the node of index <index> from the mesh.
|
||||
is static;
|
||||
|
||||
NbNodes (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of nodes in this mesh.
|
||||
is static;
|
||||
|
||||
|
||||
AddLink (me : mutable;
|
||||
theLink : Edge from BRepMesh)
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds a Link to the mesh if the Link is not
|
||||
-- already in the structure. Returns the index of
|
||||
-- the link in the structure.
|
||||
is static;
|
||||
|
||||
GetLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns Edge from BRepMesh
|
||||
---Purpose: Get the value of Link <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
RemoveLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the Link of index <Index> from the
|
||||
-- mesh.
|
||||
is static;
|
||||
|
||||
SubstituteLink (me : mutable ;
|
||||
MoveNode (me : mutable ;
|
||||
Index : Integer from Standard;
|
||||
newLink : Edge from BRepMesh)
|
||||
---Purpose: Substitutes the Link of index <Index> by
|
||||
-- <newLink> clear the connectivity.
|
||||
returns Boolean from Standard is static;
|
||||
newNode : Vertex from BRepMesh)
|
||||
---Purpose: Changes the UV value of node of index <Index> by
|
||||
-- <newNode>. Returns false if <newnode> is already in
|
||||
-- the structure.
|
||||
returns Boolean from Standard is static;
|
||||
|
||||
NbLinks (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of elements in this mesh.
|
||||
is static;
|
||||
NbNodes (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of nodes in this mesh.
|
||||
is static;
|
||||
|
||||
|
||||
AddElement (me : mutable;
|
||||
theElement : Triangle from BRepMesh)
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds an element to the mesh if it is not
|
||||
-- already in the Mesh. Returns the index of the
|
||||
-- element in the structure.
|
||||
is static;
|
||||
AddLink (me : mutable;
|
||||
theLink : Edge from BRepMesh)
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds a Link to the mesh if the Link is not
|
||||
-- already in the structure. Returns the index of
|
||||
-- the link in the structure.
|
||||
is static;
|
||||
|
||||
GetElement (me : mutable;
|
||||
GetLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns Edge from BRepMesh
|
||||
---Purpose: Get the value of Link <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
RemoveLink (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the Link of index <Index> from the
|
||||
-- mesh.
|
||||
is static;
|
||||
|
||||
SubstituteLink (me : mutable ;
|
||||
Index : Integer from Standard;
|
||||
newLink : Edge from BRepMesh)
|
||||
---Purpose: Substitutes the Link of index <Index> by
|
||||
-- <newLink> clear the connectivity.
|
||||
returns Boolean from Standard is static;
|
||||
|
||||
NbLinks (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of elements in this mesh.
|
||||
is static;
|
||||
|
||||
|
||||
AddElement (me : mutable;
|
||||
theElement : Triangle from BRepMesh)
|
||||
returns Integer from Standard
|
||||
---Purpose: Adds an element to the mesh if it is not
|
||||
-- already in the Mesh. Returns the index of the
|
||||
-- element in the structure.
|
||||
is static;
|
||||
|
||||
GetElement (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
returns Triangle from BRepMesh
|
||||
---Purpose: Get the value of Element <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
returns Triangle from BRepMesh
|
||||
---Purpose: Get the value of Element <Index>.
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
RemoveElement (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the element of index <Index> in the mesh.
|
||||
is static;
|
||||
RemoveElement (me : mutable;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Removes the element of index <Index> in the mesh.
|
||||
is static;
|
||||
|
||||
SubstituteElement (me : mutable ;
|
||||
Index : Integer from Standard;
|
||||
newElement : Triangle from BRepMesh)
|
||||
---Purpose: Substitutes the element of index <Index> by
|
||||
-- <newElement>. The links connectivity is updated.
|
||||
returns Boolean from Standard is static;
|
||||
SubstituteElement (me : mutable ;
|
||||
Index : Integer from Standard;
|
||||
newElement : Triangle from BRepMesh)
|
||||
---Purpose: Substitutes the element of index <Index> by
|
||||
-- <newElement>. The links connectivity is updated.
|
||||
returns Boolean from Standard is static;
|
||||
|
||||
NbElements (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of elements in this mesh.
|
||||
is static;
|
||||
NbElements (me)
|
||||
returns Integer from Standard
|
||||
---Purpose: Gives the number of elements in this mesh.
|
||||
is static;
|
||||
|
||||
ClearDomain (me : mutable)
|
||||
---Purpose: Removes all elements
|
||||
is static;
|
||||
|
||||
|
||||
ClearDomain (me : mutable)
|
||||
---Purpose: Removes all elements
|
||||
is static;
|
||||
|
||||
|
||||
IndexOf (me;
|
||||
IndexOf (me: mutable;
|
||||
aNode : Vertex from BRepMesh)
|
||||
---Purpose: Finds the index of the node. Returns 0 if the
|
||||
-- node is not in the mesh.
|
||||
returns Integer from Standard;
|
||||
---Purpose: Finds the index of the node. Returns 0 if the
|
||||
-- node is not in the mesh.
|
||||
returns Integer from Standard;
|
||||
|
||||
IndexOf (me;
|
||||
aLink : Edge from BRepMesh)
|
||||
---Purpose: Finds the index of the Link. Returns 0 if the
|
||||
-- Link is not in the mesh.
|
||||
---Purpose: Finds the index of the Link. Returns 0 if the
|
||||
-- Link is not in the mesh.
|
||||
returns Integer from Standard;
|
||||
|
||||
IndexOf (me;
|
||||
anElement : Triangle from BRepMesh)
|
||||
---Purpose: Finds the index of the Element. Returns 0 if
|
||||
-- the Element is not in the mesh.
|
||||
---Purpose: Finds the index of the Element. Returns 0 if
|
||||
-- the Element is not in the mesh.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
LinkNeighboursOf (me;
|
||||
theNode : in Integer from Standard)
|
||||
returns ListOfInteger from BRepMesh
|
||||
---C++: return const &
|
||||
---Purpose: Gives the list of Link's indices handling the
|
||||
-- node <theNode>.
|
||||
is static;
|
||||
LinkNeighboursOf (me;
|
||||
theNode : in Integer from Standard)
|
||||
returns ListOfInteger from BRepMesh
|
||||
---C++: return const &
|
||||
---Purpose: Gives the list of Link's indices handling the
|
||||
-- node <theNode>.
|
||||
is static;
|
||||
|
||||
|
||||
ElemConnectedTo (me;
|
||||
theLink : in Integer from Standard)
|
||||
ElemConnectedTo (me;
|
||||
theLink : in Integer from Standard)
|
||||
returns PairOfIndex from BRepMesh
|
||||
---C++: return const &
|
||||
---Purpose: Gives the element's indices conected
|
||||
@ -232,26 +230,30 @@ class DataStructureOfDelaun from BRepMesh inherits TShared from MMgt
|
||||
ClearElement (me : mutable;
|
||||
Index : Integer from Standard;
|
||||
theElem : Triangle from BRepMesh)
|
||||
---Purpose: Deletes the element of index <Index> in
|
||||
-- the mesh. Used by RemoveElement.
|
||||
---Purpose: Deletes the element of index <Index> in
|
||||
-- the mesh. Used by RemoveElement.
|
||||
is static private;
|
||||
|
||||
Statistics (me;
|
||||
flot : in out OStream from Standard)
|
||||
---Purpose: Give informations on map.
|
||||
is static;
|
||||
Statistics (me;
|
||||
flot : in out OStream from Standard)
|
||||
---Purpose: Give informations on map.
|
||||
is static;
|
||||
|
||||
Allocator (me) returns BaseAllocator from BRepMesh;
|
||||
---C++: return const&
|
||||
Allocator (me) returns BaseAllocator from BRepMesh;
|
||||
---C++: return const&
|
||||
|
||||
Data (me: mutable) returns VertexTool from BRepMesh;
|
||||
---Purpose: Give the data structure for cell size and
|
||||
-- tolerance initialization.
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields myNodes : IDMapOfNodeOfDataStructureOfDelaun from BRepMesh;
|
||||
myDelNodes : ListOfInteger from BRepMesh;
|
||||
myLinks : IDMapOfLinkOfDataStructureOfDelaun from BRepMesh;
|
||||
myDelLinks : ListOfInteger from BRepMesh;
|
||||
myElements : IMapOfElementOfDataStructureOfDelaun from BRepMesh;
|
||||
--myDelElements : ListOfInteger from BRepMesh;
|
||||
myElemOfDomain : MapOfInteger from BRepMesh;
|
||||
myLinkOfDomain : MapOfInteger from BRepMesh;
|
||||
myAllocator : BaseAllocator from BRepMesh;
|
||||
fields myNodes : VertexTool from BRepMesh;
|
||||
myLinks : IDMapOfLinkOfDataStructureOfDelaun from BRepMesh;
|
||||
myDelLinks : ListOfInteger from BRepMesh;
|
||||
myElements : IMapOfElementOfDataStructureOfDelaun from BRepMesh;
|
||||
--myDelElements : ListOfInteger from BRepMesh;
|
||||
myElemOfDomain : MapOfInteger from BRepMesh;
|
||||
myLinkOfDomain : MapOfInteger from BRepMesh;
|
||||
myAllocator : BaseAllocator from BRepMesh;
|
||||
end DataStructureOfDelaun;
|
||||
|
@ -11,8 +11,7 @@
|
||||
//=======================================================================
|
||||
BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(const BRepMesh_BaseAllocator& theAlloc,
|
||||
const Standard_Integer NodeNumber)
|
||||
: myNodes(NodeNumber+3),
|
||||
myDelNodes(theAlloc),
|
||||
: myNodes(NodeNumber, theAlloc),
|
||||
myLinks(NodeNumber*3),
|
||||
myDelLinks(theAlloc),
|
||||
myElements(NodeNumber*2),
|
||||
@ -29,23 +28,7 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(const BRepMesh_Ba
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_DataStructureOfDelaun::AddNode(const BRepMesh_Vertex& theNode)
|
||||
{
|
||||
Standard_Integer NodeIndex=myNodes.FindIndex(theNode);
|
||||
if (NodeIndex>0 && !myDelNodes.IsEmpty()) {
|
||||
if (myNodes.FindKey(NodeIndex).Movability()==BRepMesh_Deleted)
|
||||
NodeIndex=0;
|
||||
}
|
||||
if (NodeIndex<=0) {
|
||||
BRepMesh_ListOfInteger thelist(myAllocator);
|
||||
if (!myDelNodes.IsEmpty()) {
|
||||
NodeIndex=myDelNodes.First();
|
||||
myNodes.Substitute(NodeIndex, theNode, thelist);
|
||||
myDelNodes.RemoveFirst();
|
||||
}
|
||||
else {
|
||||
NodeIndex=myNodes.Add(theNode, thelist);
|
||||
}
|
||||
}
|
||||
return NodeIndex;
|
||||
return myNodes.Add(theNode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -72,14 +55,8 @@ const BRepMesh_ListOfInteger& BRepMesh_DataStructureOfDelaun::GetNodeList(const
|
||||
//=======================================================================
|
||||
void BRepMesh_DataStructureOfDelaun::ForceRemoveNode(const Standard_Integer Index)
|
||||
{
|
||||
//Warning, the static cast from const& to & is called for
|
||||
//performance reasons. This is applicable only in case if later
|
||||
//modification of element (field movability) does not influent on
|
||||
//has calculation.
|
||||
BRepMesh_Vertex& vref=(BRepMesh_Vertex&)myNodes.FindKey(Index);
|
||||
if ( myNodes.FindFromIndex(Index).Extent()==0) {
|
||||
vref.SetMovability(BRepMesh_Deleted);
|
||||
myDelNodes.Append(Index);
|
||||
myNodes.Delete(Index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,14 +64,12 @@ void BRepMesh_DataStructureOfDelaun::ForceRemoveNode(const Standard_Integer Ind
|
||||
//function : ReplaceNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DataStructureOfDelaun::ReplaceNodes(const BRepMesh_IDMapOfNodeOfDataStructureOfDelaun& NewNodes)
|
||||
void BRepMesh_DataStructureOfDelaun::ReplaceNodes(const BRepMesh_VertexTool& NewNodes)
|
||||
{
|
||||
if (NewNodes.IsEmpty() || NewNodes.Extent() != myNodes.Extent())
|
||||
if ( NewNodes.IsEmpty() )
|
||||
return;
|
||||
/*for (Standard_Integer i = 1; i <= myNodes.Extent(); i++)
|
||||
ForceRemoveNode(i);*/
|
||||
|
||||
myNodes.Assign(NewNodes);
|
||||
myNodes = NewNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -139,15 +114,9 @@ void BRepMesh_DataStructureOfDelaun::ForceRemoveLink(const Standard_Integer Ind
|
||||
//=======================================================================
|
||||
void BRepMesh_DataStructureOfDelaun::RemoveNode(const Standard_Integer Index)
|
||||
{
|
||||
//Warning, the static cast from const& to & is called for
|
||||
//performance reasons. This is applicable only in case if later
|
||||
//modification of element (field movability) does not influent on
|
||||
//has calculation.
|
||||
BRepMesh_Vertex& vref=(BRepMesh_Vertex&)myNodes.FindKey(Index);
|
||||
if (vref.Movability()==BRepMesh_Free &&
|
||||
myNodes.FindFromIndex(Index).Extent()==0) {
|
||||
vref.SetMovability(BRepMesh_Deleted);
|
||||
myDelNodes.Append(Index);
|
||||
if (myNodes.FindKey(Index).Movability() == BRepMesh_Free &&
|
||||
myNodes.FindFromIndex(Index).Extent() == 0) {
|
||||
myNodes.Delete(Index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,11 +127,8 @@ void BRepMesh_DataStructureOfDelaun::RemoveNode(const Standard_Integer Index)
|
||||
Standard_Boolean BRepMesh_DataStructureOfDelaun::MoveNode(const Standard_Integer Index,
|
||||
const BRepMesh_Vertex& newNode)
|
||||
{
|
||||
if (myNodes.FindIndex(newNode)==0) {
|
||||
BRepMesh_Vertex vref(myNodes.FindKey(Index));
|
||||
const BRepMesh_ListOfInteger& refLink=myNodes(Index);
|
||||
vref.SetMovability(BRepMesh_Deleted);
|
||||
myNodes.Substitute(Index, vref, refLink);
|
||||
if (myNodes.FindIndex(newNode) == 0) {
|
||||
const BRepMesh_ListOfInteger& refLink = myNodes(Index);
|
||||
myNodes.Substitute(Index, newNode, refLink);
|
||||
return Standard_True;
|
||||
}
|
||||
@ -452,7 +418,7 @@ Standard_Integer BRepMesh_DataStructureOfDelaun::NbElements()const
|
||||
//function : IndexOf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_DataStructureOfDelaun::IndexOf(const BRepMesh_Vertex& aNode)const
|
||||
Standard_Integer BRepMesh_DataStructureOfDelaun::IndexOf(const BRepMesh_Vertex& aNode)
|
||||
{
|
||||
return myNodes.FindIndex(aNode);
|
||||
}
|
||||
@ -561,8 +527,7 @@ void BRepMesh_DataStructureOfDelaun::ClearDeleted()
|
||||
}
|
||||
*/
|
||||
|
||||
// Traitement des Links
|
||||
|
||||
// Process Links:
|
||||
lastNonDelItem=myLinks.Extent();
|
||||
|
||||
while (!myDelLinks.IsEmpty()) {
|
||||
@ -573,10 +538,10 @@ void BRepMesh_DataStructureOfDelaun::ClearDeleted()
|
||||
lastNonDelItem--;
|
||||
}
|
||||
|
||||
IndexDelItem=myDelLinks.First();
|
||||
IndexDelItem = myDelLinks.First();
|
||||
myDelLinks.RemoveFirst();
|
||||
|
||||
if (IndexDelItem<lastNonDelItem) {
|
||||
if (IndexDelItem < lastNonDelItem) {
|
||||
BRepMesh_Edge lItem=myLinks.FindKey(lastNonDelItem);
|
||||
BRepMesh_PairOfIndex Data(myLinks(lastNonDelItem));
|
||||
myLinks.RemoveLast();
|
||||
@ -620,22 +585,22 @@ void BRepMesh_DataStructureOfDelaun::ClearDeleted()
|
||||
}
|
||||
|
||||
|
||||
// Traitement des Nodes :
|
||||
// Process Nodes:
|
||||
lastNonDelItem = myNodes.Extent();
|
||||
BRepMesh_ListOfInteger &aDelNodes = (BRepMesh_ListOfInteger &)myNodes.GetListOfDelNodes();
|
||||
|
||||
lastNonDelItem=myNodes.Extent();
|
||||
|
||||
while (!myDelNodes.IsEmpty()) {
|
||||
while (lastNonDelItem>0) {
|
||||
while (!aDelNodes.IsEmpty()) {
|
||||
while (lastNonDelItem > 0) {
|
||||
if (myNodes.FindKey(lastNonDelItem).Movability()!=BRepMesh_Deleted)
|
||||
break;
|
||||
myNodes.RemoveLast();
|
||||
lastNonDelItem--;
|
||||
}
|
||||
IndexDelItem=myDelNodes.First();
|
||||
myDelNodes.RemoveFirst();
|
||||
IndexDelItem = aDelNodes.First();
|
||||
aDelNodes.RemoveFirst();
|
||||
|
||||
if (IndexDelItem<lastNonDelItem) {
|
||||
BRepMesh_Vertex nItem=myNodes.FindKey(lastNonDelItem);
|
||||
BRepMesh_Vertex nItem = myNodes.FindKey(lastNonDelItem);
|
||||
BRepMesh_ListOfInteger Data;
|
||||
Data.Append(myNodes(lastNonDelItem));
|
||||
myNodes.RemoveLast();
|
||||
@ -666,7 +631,7 @@ void BRepMesh_DataStructureOfDelaun::Statistics(Standard_OStream& S) const
|
||||
{
|
||||
S << " Map de nodes : \n";
|
||||
myNodes.Statistics(S);
|
||||
S << "\n Deleted nodes : " << myDelNodes.Extent() << endl;
|
||||
S << "\n Deleted nodes : " << myNodes.GetListOfDelNodes().Extent() << endl;
|
||||
|
||||
S << "\n\n Map de Links : \n";
|
||||
myLinks.Statistics(S);
|
||||
@ -685,3 +650,12 @@ const BRepMesh_BaseAllocator& BRepMesh_DataStructureOfDelaun::Allocator() const
|
||||
{
|
||||
return myAllocator;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Data
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_VertexTool& BRepMesh_DataStructureOfDelaun::Data()
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
@ -87,6 +87,8 @@
|
||||
#include <tbb/parallel_for_each.h>
|
||||
#endif
|
||||
|
||||
#define UVDEFLECTION 1.e-05
|
||||
|
||||
inline Standard_Real MaxFaceTol (const TopoDS_Face& theFace)
|
||||
{
|
||||
Standard_Real T, TMax = BRep_Tool::Tolerance(theFace);
|
||||
@ -235,6 +237,14 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
||||
Handle(NCollection_IncAllocator) anAlloc = Handle(NCollection_IncAllocator)::DownCast(myAllocator);
|
||||
anAlloc->Reset(Standard_False);
|
||||
myStructure=new BRepMesh_DataStructureOfDelaun(anAlloc);
|
||||
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
BRepTools::UVBounds(theface, aXmin, aXmax, aYmin, aYmax);
|
||||
Standard_Real aTolU = (aXmax - aXmin) * UVDEFLECTION;
|
||||
Standard_Real aTolV = (aYmax - aYmin) * UVDEFLECTION;
|
||||
myStructure->Data().SetCellSize ( 14 * aTolU, 14 * aTolV );
|
||||
myStructure->Data().SetTolerance( aTolU, aTolV );
|
||||
|
||||
BRepAdaptor_Surface BS(face, Standard_False);
|
||||
Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
|
||||
|
||||
@ -260,7 +270,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
||||
i = 1;
|
||||
|
||||
Standard_Real defedge, defface;
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
|
||||
Standard_Real dx, dy, dz;
|
||||
Standard_Integer nbEdge = 0;
|
||||
Standard_Real savangle = myAngle;
|
||||
Standard_Real cdef;
|
||||
@ -313,7 +323,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
||||
else defedge = myDeflection;
|
||||
|
||||
defedge = Max(maxdef, defedge);
|
||||
defedge = Max(1.e-05 , defedge);
|
||||
defedge = Max(UVDEFLECTION , defedge);
|
||||
myMapdefle.Bind(edge, defedge);
|
||||
}
|
||||
else{
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include <GeomLib.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
|
||||
#define UVDEFLECTION 1.e-05
|
||||
|
||||
static Standard_Real FUN_CalcAverageDUV(TColStd_Array1OfReal& P, const Standard_Integer PLen)
|
||||
{
|
||||
Standard_Integer i, j, n = 0;
|
||||
@ -112,6 +114,21 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
Handle(NCollection_IncAllocator) anAlloc = Handle(NCollection_IncAllocator)::DownCast(myAllocator);
|
||||
anAlloc->Reset(Standard_False);
|
||||
myStructure=new BRepMesh_DataStructureOfDelaun(anAlloc);
|
||||
|
||||
Standard_Real umax = myAttrib->GetUMax();
|
||||
Standard_Real umin = myAttrib->GetUMin();
|
||||
Standard_Real vmax = myAttrib->GetVMax();
|
||||
Standard_Real vmin = myAttrib->GetVMin();
|
||||
|
||||
Standard_Real aTolU = (umax - umin) * UVDEFLECTION;
|
||||
Standard_Real aTolV = (vmax - vmin) * UVDEFLECTION;
|
||||
Standard_Real uCellSize = 14 * aTolU;
|
||||
Standard_Real vCellSize = 14 * aTolV;
|
||||
|
||||
myStructure->Data().SetCellSize ( uCellSize, vCellSize );
|
||||
myStructure->Data().SetTolerance( aTolU, aTolV );
|
||||
|
||||
|
||||
BRepAdaptor_Surface BS(face, Standard_False);
|
||||
Handle(BRepAdaptor_HSurface) gFace = new BRepAdaptor_HSurface(BS);
|
||||
|
||||
@ -165,10 +182,8 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
//Standard_Real longu = 0.0, longv = 0.0; //, last , first;
|
||||
//gp_Pnt P11, P12, P21, P22, P31, P32;
|
||||
|
||||
Standard_Real umax = myAttrib->GetUMax();
|
||||
Standard_Real umin = myAttrib->GetUMin();
|
||||
Standard_Real vmax = myAttrib->GetVMax();
|
||||
Standard_Real vmin = myAttrib->GetVMin();
|
||||
Standard_Real deltaX = myAttrib->GetDeltaX();
|
||||
Standard_Real deltaY = myAttrib->GetDeltaY();
|
||||
|
||||
TColStd_Array1OfInteger tabvert_corr(1, nbVertices);
|
||||
gp_Pnt2d p2d;
|
||||
@ -180,8 +195,11 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
myUParam.Clear();
|
||||
myVParam.Clear();
|
||||
|
||||
BRepMesh_IDMapOfNodeOfDataStructureOfDelaun aMoveNodes(myVemap.Extent());
|
||||
BRepMesh_VertexTool aMoveNodes(myVemap.Extent(), myAllocator);
|
||||
|
||||
aMoveNodes.SetCellSize ( uCellSize / deltaX, vCellSize / deltaY);
|
||||
aMoveNodes.SetTolerance( aTolU / deltaX, aTolV / deltaY);
|
||||
|
||||
for (i = 1; i <= myStructure->NbNodes(); i++)
|
||||
{
|
||||
const BRepMesh_Vertex& v = myStructure->GetNode(i);
|
||||
@ -191,15 +209,15 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
myVParam.Add(p2d.Y());
|
||||
}
|
||||
gp_XY res;
|
||||
res.SetCoord((p2d.X()-(myAttrib->GetMinX()))/(myAttrib->GetDeltaX()),
|
||||
(p2d.Y()-(myAttrib->GetMinY()))/(myAttrib->GetDeltaY()));
|
||||
res.SetCoord((p2d.X() - umin ) / deltaX,
|
||||
(p2d.Y() - vmin ) / deltaY);
|
||||
BRepMesh_Vertex v_new(res,v.Location3d(),v.Movability());
|
||||
const BRepMesh_ListOfInteger& alist = myStructure->GetNodeList(i);
|
||||
aMoveNodes.Add(v_new,alist);
|
||||
aMoveNodes.Add(v_new, alist);
|
||||
tabvert_corr(i) = i;
|
||||
}
|
||||
myStructure->ReplaceNodes(aMoveNodes);
|
||||
|
||||
|
||||
Standard_Boolean rajout;
|
||||
|
||||
BRepMesh_ClassifierPtr& classifier = theAttrib->GetClassifier();
|
||||
@ -234,7 +252,7 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
}
|
||||
|
||||
Standard_Boolean isaline;
|
||||
isaline = ((umax-umin)<1.e-05) || ((vmax-vmin)<1.e-05);
|
||||
isaline = ((umax-umin) < UVDEFLECTION) || ((vmax-vmin) < UVDEFLECTION);
|
||||
|
||||
Standard_Real aDef = -1;
|
||||
if (!isaline && myStructure->ElemOfDomain().Extent() > 0) {
|
||||
@ -281,18 +299,17 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
||||
}
|
||||
|
||||
//modify myStructure back
|
||||
aMoveNodes.Clear();
|
||||
Standard_Real deltaX = myAttrib->GetDeltaX();
|
||||
Standard_Real deltaY = myAttrib->GetDeltaY();
|
||||
aMoveNodes.SetCellSize ( uCellSize, vCellSize );
|
||||
aMoveNodes.SetTolerance( aTolU , aTolV );
|
||||
for (i = 1; i <= myStructure->NbNodes(); i++)
|
||||
{
|
||||
const BRepMesh_Vertex& v = myStructure->GetNode(i);
|
||||
p2d = v.Coord();
|
||||
gp_XY res;
|
||||
res.SetCoord(p2d.X()*deltaX+umin,p2d.Y()*deltaY+vmin);
|
||||
res.SetCoord(p2d.X() * deltaX + umin, p2d.Y() * deltaY + vmin);
|
||||
BRepMesh_Vertex v_new(res,v.Location3d(),v.Movability());
|
||||
const BRepMesh_ListOfInteger& alist = myStructure->GetNodeList(i);
|
||||
aMoveNodes.Add(v_new,alist);
|
||||
aMoveNodes.Add(v_new, alist);
|
||||
}
|
||||
myStructure->ReplaceNodes(aMoveNodes);
|
||||
|
||||
@ -1607,6 +1624,7 @@ void BRepMesh_FastDiscretFace::AddInShape(const TopoDS_Face& theFace,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
// MESH_FAILURE(theFace);
|
||||
|
19
src/BRepMesh/BRepMesh_VectorOfVertex.hxx
Normal file
19
src/BRepMesh/BRepMesh_VectorOfVertex.hxx
Normal file
@ -0,0 +1,19 @@
|
||||
// File: BRepMesh_VectorOfVertex.hxx
|
||||
// Created: Jun 1 18:11:53 2011
|
||||
// Author: Oleg AGASHIN
|
||||
// Copyright: Open CASCADE SAS 2011
|
||||
|
||||
|
||||
#ifndef _BRepMesh_VectorOfVertex_HeaderFile
|
||||
#define _BRepMesh_VectorOfVertex_HeaderFile
|
||||
|
||||
#ifndef _BRepMesh_Vertex_HeaderFile
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#endif
|
||||
#ifndef NCollection_Vector_HeaderFile
|
||||
#include <NCollection_Vector.hxx>
|
||||
#endif
|
||||
|
||||
typedef NCollection_Vector<BRepMesh_Vertex> BRepMesh_VectorOfVertex;
|
||||
|
||||
#endif
|
24
src/BRepMesh/BRepMesh_VertexCellFilter.hxx
Normal file
24
src/BRepMesh/BRepMesh_VertexCellFilter.hxx
Normal file
@ -0,0 +1,24 @@
|
||||
// File: BRepMesh_VertexCellFilter.hxx
|
||||
// Created: Jun 2 10:17:51 2011
|
||||
// Author: Oleg AGASHIN
|
||||
// Copyright: Open CASCADE SAS 2011
|
||||
|
||||
#ifndef _BRepMesh_VertexCellFilter_HeaderFile
|
||||
#define _BRepMesh_VertexCellFilter_HeaderFile
|
||||
|
||||
#ifndef _gp_XYZ_HeaderFile
|
||||
#include <gp_XYZ.hxx>
|
||||
#endif
|
||||
#ifndef _gp_XY_HeaderFile
|
||||
#include <gp_XY.hxx>
|
||||
#endif
|
||||
#ifndef NCollection_CellFilter_HeaderFile
|
||||
#include <NCollection_CellFilter.hxx>
|
||||
#endif
|
||||
#ifndef _BRepMesh_VertexInspector_HeaderFile
|
||||
#include <BRepMesh_VertexInspector.hxx>
|
||||
#endif
|
||||
|
||||
typedef NCollection_CellFilter<BRepMesh_VertexInspector> BRepMesh_VertexCellFilter;
|
||||
|
||||
#endif
|
102
src/BRepMesh/BRepMesh_VertexInspector.cxx
Normal file
102
src/BRepMesh/BRepMesh_VertexInspector.cxx
Normal file
@ -0,0 +1,102 @@
|
||||
// File: BRepMesh_VertexInspector.cxx
|
||||
// Created: Jun 1 18:32:12 2011
|
||||
// Author: Oleg AGASHIN
|
||||
// Copyright: Open CASCADE SAS 2011
|
||||
|
||||
#include <gp_XY.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <BRepMesh_VertexInspector.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_VertexInspector
|
||||
//purpose : Constructor
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
BRepMesh_VertexInspector::BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const BRepMesh_BaseAllocator& theAlloc)
|
||||
: myTol(0,1),
|
||||
myResInd(theAlloc),
|
||||
myVertices(nbComp),
|
||||
myDelNodes(theAlloc)
|
||||
{
|
||||
SetTolerance( Precision::Confusion() );
|
||||
}
|
||||
|
||||
BRepMesh_VertexInspector::BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const Standard_Real aTol,
|
||||
const BRepMesh_BaseAllocator& theAlloc)
|
||||
: myTol(0,1),
|
||||
myResInd(theAlloc),
|
||||
myVertices(nbComp),
|
||||
myDelNodes(theAlloc)
|
||||
{
|
||||
SetTolerance( aTol );
|
||||
}
|
||||
|
||||
BRepMesh_VertexInspector::BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const Standard_Real aTolX,
|
||||
const Standard_Real aTolY,
|
||||
const BRepMesh_BaseAllocator& theAlloc)
|
||||
: myTol(0,1),
|
||||
myResInd(theAlloc),
|
||||
myVertices(nbComp),
|
||||
myDelNodes(theAlloc)
|
||||
{
|
||||
SetTolerance( aTolX, aTolY );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Inspect
|
||||
//purpose :
|
||||
//
|
||||
//=======================================================================
|
||||
NCollection_CellFilter_Action BRepMesh_VertexInspector::Inspect (const Standard_Integer theTarget)
|
||||
{
|
||||
const BRepMesh_Vertex& aVertex = myVertices(theTarget-1);
|
||||
if( aVertex.Movability() == BRepMesh_Deleted )
|
||||
{
|
||||
myDelNodes.Append(theTarget);
|
||||
return CellFilter_Purge;
|
||||
}
|
||||
|
||||
const gp_XY& aPos = aVertex.Coord();
|
||||
Standard_Real dx,dy;
|
||||
dx = myCurrent.X() - aPos.X();
|
||||
dy = myCurrent.Y() - aPos.Y();
|
||||
|
||||
Standard_Boolean inTol;
|
||||
if ( myTol(1) == 0. )
|
||||
{
|
||||
inTol = (dx*dx + dy*dy) <= myTol(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
inTol = ( (dx*dx) <= myTol(0) ) &&
|
||||
( (dy*dy) <= myTol(1) );
|
||||
}
|
||||
if ( inTol )
|
||||
myResInd.Append(theTarget);
|
||||
return CellFilter_Keep;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_VertexInspector::Add(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
if( myDelNodes.IsEmpty() )
|
||||
{
|
||||
myVertices.Append(theVertex);
|
||||
return myVertices.Length();
|
||||
}
|
||||
|
||||
Standard_Integer aNodeIndex = myDelNodes.First();
|
||||
myVertices(aNodeIndex-1) = theVertex;
|
||||
myDelNodes.RemoveFirst();
|
||||
return aNodeIndex;
|
||||
}
|
132
src/BRepMesh/BRepMesh_VertexInspector.hxx
Normal file
132
src/BRepMesh/BRepMesh_VertexInspector.hxx
Normal file
@ -0,0 +1,132 @@
|
||||
// File: BRepMesh_VertexInspector.hxx
|
||||
// Created: Jun 1 18:13:23 2011
|
||||
// Author: Oleg AGASHIN
|
||||
// Copyright: Open CASCADE SAS 2011
|
||||
|
||||
|
||||
#ifndef _BRepMesh_VertexInspector_HeaderFile
|
||||
#define _BRepMesh_VertexInspector_HeaderFile
|
||||
|
||||
#include <BRepMesh_ListOfInteger.hxx>
|
||||
#ifndef _Precision_HeaderFile
|
||||
#include <Precision.hxx>
|
||||
#endif
|
||||
#ifndef _gp_XY_HeaderFile
|
||||
#include <gp_XY.hxx>
|
||||
#endif
|
||||
#ifndef _gp_XYZ_HeaderFile
|
||||
#include <gp_XYZ.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef NCollection_CellFilter_HeaderFile
|
||||
#include <NCollection_CellFilter.hxx>
|
||||
#endif
|
||||
#ifndef _BRepMesh_Vertex_HeaderFile
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#endif
|
||||
#ifndef _BRepMesh_VectorOfVertex_HeaderFile
|
||||
#include <BRepMesh_VectorOfVertex.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_Array1OfReal_HeaderFile
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#endif
|
||||
#include <BRepMesh_BaseAllocator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//! The class to find in the coincidence points
|
||||
//=======================================================================
|
||||
|
||||
class BRepMesh_VertexInspector : public NCollection_CellFilter_InspectorXY
|
||||
{
|
||||
public:
|
||||
typedef Standard_Integer Target;
|
||||
//! Constructor; remembers tolerance and collector data structure.
|
||||
//! theTol can be Real or Array1OfReal with two elements which describe
|
||||
//! tolerance for each dimension.
|
||||
BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const BRepMesh_BaseAllocator& theAlloc);
|
||||
|
||||
BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const Standard_Real theTol,
|
||||
const BRepMesh_BaseAllocator& theAlloc);
|
||||
|
||||
BRepMesh_VertexInspector (const Standard_Integer nbComp,
|
||||
const Standard_Real aTolX,
|
||||
const Standard_Real aTolY,
|
||||
const BRepMesh_BaseAllocator& theAlloc);
|
||||
|
||||
Standard_Integer Add(const BRepMesh_Vertex& theVertex);
|
||||
|
||||
void SetTolerance(const Standard_Real theTol)
|
||||
{
|
||||
myTol(0) = theTol*theTol;
|
||||
myTol(1) = 0.;
|
||||
}
|
||||
|
||||
void SetTolerance(const Standard_Real theTolX, const Standard_Real theTolY)
|
||||
{
|
||||
myTol(0) = theTolX*theTolX;
|
||||
myTol(1) = theTolY*theTolY;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
myVertices.Clear();
|
||||
myDelNodes.Clear();
|
||||
}
|
||||
|
||||
void Delete(const Standard_Integer theIndex)
|
||||
{
|
||||
myVertices(theIndex-1).SetMovability(BRepMesh_Deleted);
|
||||
myDelNodes.Append(theIndex);
|
||||
}
|
||||
|
||||
Standard_Integer GetNbVertices() const
|
||||
{
|
||||
return myVertices.Length();
|
||||
}
|
||||
|
||||
BRepMesh_Vertex& GetVertex(Standard_Integer theInd)
|
||||
{
|
||||
return myVertices(theInd-1);
|
||||
}
|
||||
|
||||
//! Set current node to be checked
|
||||
void SetCurrent (const gp_XY& theCurVertex, const Standard_Boolean theExactVal = Standard_False)
|
||||
{
|
||||
myResInd.Clear();
|
||||
myCurrent = theCurVertex;
|
||||
}
|
||||
|
||||
//!Get result index of node
|
||||
const Standard_Integer GetCoincidentInd() const
|
||||
{
|
||||
if ( myResInd.Size() > 0 )
|
||||
{
|
||||
return myResInd.First();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const BRepMesh_ListOfInteger& GetListOfDelNodes() const
|
||||
{
|
||||
return myDelNodes;
|
||||
}
|
||||
|
||||
//! Implementation of inspection method
|
||||
NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
|
||||
|
||||
static Standard_Boolean IsEqual (Standard_Integer theIdx, const Standard_Integer theTarget)
|
||||
{
|
||||
return (theIdx == theTarget);
|
||||
}
|
||||
|
||||
private:
|
||||
TColStd_Array1OfReal myTol;
|
||||
BRepMesh_ListOfInteger myResInd;
|
||||
BRepMesh_VectorOfVertex myVertices;
|
||||
BRepMesh_ListOfInteger myDelNodes;
|
||||
gp_XY myCurrent;
|
||||
};
|
||||
|
||||
#endif
|
131
src/BRepMesh/BRepMesh_VertexTool.cdl
Normal file
131
src/BRepMesh/BRepMesh_VertexTool.cdl
Normal file
@ -0,0 +1,131 @@
|
||||
-- File: BRepMesh_VertexTool.cdl
|
||||
-- Created: Jun 2 11:35:21 2011
|
||||
-- Author: Oleg AGASHIN
|
||||
---Copyright: Open CASCADE SAS 2011
|
||||
|
||||
|
||||
class VertexTool from BRepMesh
|
||||
|
||||
---Purpose: Describes the data structure necessary for the
|
||||
-- mesh algorithm and contains the vertices in UV space.
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
Real from Standard,
|
||||
XY from gp,
|
||||
ListOfInteger from BRepMesh,
|
||||
VertexCellFilter from BRepMesh,
|
||||
VertexInspector from BRepMesh,
|
||||
BaseAllocator from BRepMesh,
|
||||
Vertex from BRepMesh,
|
||||
DataMapOfIntegerListOfInteger from BRepMesh,
|
||||
Array1OfReal from TColStd
|
||||
|
||||
is Create (theAlloc : in BaseAllocator from BRepMesh)
|
||||
returns VertexTool from BRepMesh;
|
||||
|
||||
|
||||
Create (nbComp : in Integer from Standard;
|
||||
theAlloc : in BaseAllocator from BRepMesh)
|
||||
---Purpose: Constructs a VertexTool with an evaluation of the
|
||||
-- number of vertices.
|
||||
returns VertexTool from BRepMesh;
|
||||
|
||||
SetCellSize(me : in out;
|
||||
theSize : in Real from Standard)
|
||||
---Purpose: Sets new size for cellfilter.
|
||||
is static;
|
||||
|
||||
SetCellSize(me : in out;
|
||||
theXSize : in Real from Standard;
|
||||
theYSize : in Real from Standard)
|
||||
---Purpose: Sets new size for cellfilter.
|
||||
is static;
|
||||
|
||||
SetTolerance(me : in out;
|
||||
theTol : in Real from Standard)
|
||||
---Purpose: Sets new size for cellfilter.
|
||||
is static;
|
||||
|
||||
SetTolerance(me : in out;
|
||||
theTolX : in Real from Standard;
|
||||
theTolY : in Real from Standard)
|
||||
---Purpose: Sets new size for cellfilter.
|
||||
is static;
|
||||
|
||||
Add (me : in out;
|
||||
theVertex: in Vertex from BRepMesh;
|
||||
theParams: in ListOfInteger from BRepMesh)
|
||||
---Purpose: Adds a vertex to the tool.
|
||||
returns Integer from Standard is static;
|
||||
|
||||
Add (me : in out;
|
||||
theVertex: in Vertex from BRepMesh)
|
||||
---Purpose: Adds a vertex to the tool.
|
||||
returns Integer from Standard is static;
|
||||
|
||||
Delete (me : in out; theIndex : Integer from Standard)
|
||||
---Purpose: Deletes a vertex from the tool.
|
||||
is static;
|
||||
|
||||
FindFromIndex (me; theIndex : Integer from Standard)
|
||||
---Purpose: Returns data assigned to theIndex.
|
||||
---C++: alias operator()
|
||||
---C++: return &
|
||||
returns ListOfInteger from BRepMesh is static;
|
||||
|
||||
FindKey (me: out; theIndex: Integer from Standard)
|
||||
---Purpose: Selects the vertex by theIndex.
|
||||
---C++: return const &
|
||||
returns Vertex from BRepMesh is static;
|
||||
|
||||
FindIndex (me: out;
|
||||
theVertex: Vertex from BRepMesh)
|
||||
---Purpose: Returns an index of theVertex.
|
||||
returns Integer from Standard is static;
|
||||
|
||||
Extent (me)
|
||||
---Purpose: Returns a number of vertices.
|
||||
returns Integer from Standard is static;
|
||||
|
||||
IsEmpty (me)
|
||||
---Purpose: Returns True when the map contains no keys.
|
||||
returns Boolean from Standard is static;
|
||||
|
||||
Substitute(me: in out; Index: Integer from Standard;
|
||||
theVertex: Vertex from BRepMesh;
|
||||
theData : ListOfInteger from BRepMesh)
|
||||
---Purpose: Substitutes vertex with Index on
|
||||
-- theVertex with attributes theData.
|
||||
is static;
|
||||
|
||||
RemoveLast(me: out)
|
||||
---Purpose: Remove last node from the structure.
|
||||
is static;
|
||||
|
||||
GetListOfDelNodes(me)
|
||||
---Purpose: Returns the list with indexes of
|
||||
-- vertices that have Movability attribute
|
||||
-- equal to BRepMesh_Deleted and can be
|
||||
-- replaced with another node.
|
||||
---C++: return const &
|
||||
returns ListOfInteger from BRepMesh
|
||||
is static;
|
||||
|
||||
ExpandPoint(me: in out;
|
||||
thePnt: in XY from gp;
|
||||
theMinPnt: out XY from gp;
|
||||
theMaxPnt: out XY from gp)
|
||||
is static private;
|
||||
|
||||
Statistics(me; S: in out OStream from Standard)
|
||||
---Purpose: Prints statistics.
|
||||
is static;
|
||||
|
||||
fields myAllocator : BaseAllocator from BRepMesh;
|
||||
myCellFilter : VertexCellFilter from BRepMesh;
|
||||
mySelector : VertexInspector from BRepMesh;
|
||||
myLinksMap : DataMapOfIntegerListOfInteger from BRepMesh;
|
||||
myTol : Array1OfReal from TColStd;
|
||||
|
||||
end CircleTool;
|
236
src/BRepMesh/BRepMesh_VertexTool.cxx
Normal file
236
src/BRepMesh/BRepMesh_VertexTool.cxx
Normal file
@ -0,0 +1,236 @@
|
||||
// File: BRepMesh_VertexTool.cxx
|
||||
// Created: Jun 2 10:19:12 2011
|
||||
// Author: Oleg AGASHIN
|
||||
// Copyright: Open CASCADE SAS 2011
|
||||
|
||||
#include <BRepMesh_VertexTool.ixx>
|
||||
#include <gp_XY.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#include <BRepMesh_VertexInspector.hxx>
|
||||
#include <BRepMesh_BaseAllocator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_VertexTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_VertexTool::BRepMesh_VertexTool(const BRepMesh_BaseAllocator& theAlloc)
|
||||
: myAllocator(theAlloc),
|
||||
myCellFilter(0., myAllocator),
|
||||
mySelector(64,myAllocator),
|
||||
myTol(0,1)
|
||||
{
|
||||
SetCellSize ( Precision::Confusion()+0.05*Precision::Confusion() );
|
||||
SetTolerance( Precision::Confusion(), Precision::Confusion() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_VertexTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_VertexTool::BRepMesh_VertexTool(const Standard_Integer nbComp,
|
||||
const BRepMesh_BaseAllocator& theAlloc)
|
||||
: myAllocator(theAlloc),
|
||||
myCellFilter(0., myAllocator),
|
||||
mySelector(Max(nbComp,64),myAllocator),
|
||||
myTol(0,1)
|
||||
{
|
||||
SetCellSize ( Precision::Confusion()+0.05*Precision::Confusion() );
|
||||
SetTolerance( Precision::Confusion(), Precision::Confusion() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCellSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::SetCellSize(const Standard_Real theSize)
|
||||
{
|
||||
myCellFilter.Reset(theSize, myAllocator);
|
||||
mySelector.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCellSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::SetCellSize(const Standard_Real theXSize,
|
||||
const Standard_Real theYSize)
|
||||
{
|
||||
Standard_Real aCellSize[2];
|
||||
aCellSize[0] = theXSize;
|
||||
aCellSize[1] = theYSize;
|
||||
|
||||
myCellFilter.Reset(aCellSize, myAllocator);
|
||||
mySelector.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::SetTolerance(const Standard_Real theTol)
|
||||
{
|
||||
mySelector.SetTolerance( theTol );
|
||||
myTol(0) = theTol;
|
||||
myTol(1) = theTol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::SetTolerance(const Standard_Real theTolX, const Standard_Real theTolY)
|
||||
{
|
||||
mySelector.SetTolerance( theTolX, theTolY );
|
||||
myTol(0) = theTolX;
|
||||
myTol(1) = theTolY;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_VertexTool::Add(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
Standard_Integer anIndex = FindIndex(theVertex);
|
||||
if ( anIndex == 0 )
|
||||
{
|
||||
BRepMesh_ListOfInteger thelist(myAllocator);
|
||||
anIndex = Add(theVertex, thelist);
|
||||
}
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_VertexTool::Add(const BRepMesh_Vertex& theVertex,
|
||||
const BRepMesh_ListOfInteger& theParams)
|
||||
{
|
||||
Standard_Integer anIndex = mySelector.Add(theVertex);
|
||||
myLinksMap.Bind(anIndex, theParams);
|
||||
gp_XY aMinPnt, aMaxPnt;
|
||||
ExpandPoint(theVertex.Coord(), aMinPnt, aMaxPnt);
|
||||
myCellFilter.Add(anIndex, aMinPnt, aMaxPnt);
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Delete
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::Delete(const Standard_Integer theIndex)
|
||||
{
|
||||
BRepMesh_Vertex& aV = mySelector.GetVertex(theIndex);
|
||||
gp_XY aMinPnt, aMaxPnt;
|
||||
ExpandPoint(aV.Coord(), aMinPnt, aMaxPnt);
|
||||
myCellFilter.Remove (theIndex, aMinPnt, aMaxPnt);
|
||||
mySelector.Delete(theIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveLast
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::RemoveLast()
|
||||
{
|
||||
Standard_Integer aIndex = mySelector.GetNbVertices();
|
||||
Delete( aIndex );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetListOfDelNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BRepMesh_ListOfInteger& BRepMesh_VertexTool::GetListOfDelNodes() const
|
||||
{
|
||||
return mySelector.GetListOfDelNodes();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindIndex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_VertexTool::FindIndex(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
mySelector.SetCurrent(theVertex.Coord());
|
||||
myCellFilter.Inspect (theVertex.Coord(), mySelector);
|
||||
return mySelector.GetCoincidentInd();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindKey
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BRepMesh_Vertex& BRepMesh_VertexTool::FindKey(const Standard_Integer theIndex)
|
||||
{
|
||||
return mySelector.GetVertex(theIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Substitute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::Substitute(const Standard_Integer Index,
|
||||
const BRepMesh_Vertex& theVertex,
|
||||
const BRepMesh_ListOfInteger& theData)
|
||||
{
|
||||
BRepMesh_Vertex& aV = mySelector.GetVertex(Index);
|
||||
gp_XY aMinPnt, aMaxPnt;
|
||||
ExpandPoint(aV.Coord(), aMinPnt, aMaxPnt);
|
||||
myCellFilter.Remove (Index, aMinPnt, aMaxPnt);
|
||||
aV = theVertex;
|
||||
ExpandPoint(aV.Coord(), aMinPnt, aMaxPnt);
|
||||
myCellFilter.Add(Index, aMinPnt, aMaxPnt);
|
||||
FindFromIndex(Index) = theData;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_VertexTool::Extent() const
|
||||
{
|
||||
return mySelector.GetNbVertices();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_VertexTool::IsEmpty() const
|
||||
{
|
||||
return mySelector.GetNbVertices() == 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindFromIndex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_ListOfInteger& BRepMesh_VertexTool::FindFromIndex(const Standard_Integer theIndex) const
|
||||
{
|
||||
return (BRepMesh_ListOfInteger&) myLinksMap.Find(theIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::ExpandPoint(const gp_XY& thePnt, gp_XY& theMinPnt, gp_XY& theMaxPnt)
|
||||
{
|
||||
theMinPnt.SetX(thePnt.X() - myTol(0));
|
||||
theMinPnt.SetY(thePnt.Y() - myTol(1));
|
||||
theMaxPnt.SetX(thePnt.X() + myTol(0));
|
||||
theMaxPnt.SetY(thePnt.Y() + myTol(1));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Statistics
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_VertexTool::Statistics(Standard_OStream& S) const
|
||||
{
|
||||
S <<"\nStructure Statistics\n---------------\n\n";
|
||||
S <<"This structure has "<<mySelector.GetNbVertices()<<" Nodes\n\n";
|
||||
}
|
@ -9,4 +9,8 @@ BRepMesh_BaseAllocator.hxx
|
||||
BRepMesh_PairOfIndex.hxx
|
||||
BRepMesh_Status.hxx
|
||||
BRepMesh_CMPLRS.edl
|
||||
BRepMesh_VertexCellFilter.hxx
|
||||
BRepMesh_VertexInspector.hxx
|
||||
BRepMesh_VertexInspector.cxx
|
||||
BRepMesh_VectorOfVertex.hxx
|
||||
EXTERNLIB
|
||||
|
Loading…
x
Reference in New Issue
Block a user