![]() |
VCG Library
|
Class to safely add and delete elements in a mesh. More...
#include <allocate.h>
Classes | |
class | PointerUpdater |
Accessory class to update pointers after eventual reallocation caused by adding elements. More... | |
Static Public Member Functions | |
static VertexIterator | AddVertices (MeshType &m, size_t n, PointerUpdater< VertexPointer > &pu) |
Add n vertices to the mesh. Function to add n vertices to the mesh. The elements are added always to the end of the vector. No attempt of reusing previously deleted element is done. | |
static VertexIterator | AddVertices (MeshType &m, size_t n) |
Wrapper to AddVertices(); no PointerUpdater. | |
static VertexIterator | AddVertices (MeshType &m, size_t n, std::vector< VertexPointer * > &local_vec) |
Wrapper to AddVertices() no PointerUpdater but a vector of VertexPointer pointers to be updated. | |
static VertexIterator | AddVertex (MeshType &m, const CoordType &p) |
Wrapper to AddVertices() to add a single vertex with given coords. | |
static VertexIterator | AddVertex (MeshType &m, const CoordType &p, const CoordType &n) |
Wrapper to AddVertices() to add a single vertex with given coords and normal. | |
static VertexIterator | AddVertex (MeshType &m, const CoordType &p, const Color4b &c) |
Wrapper to AddVertices() to add a single vertex with given coords and color. | |
static EdgeIterator | AddEdges (MeshType &m, size_t n, PointerUpdater< EdgePointer > &pu) |
Add n edges to the mesh. Function to add n edges to the mesh. The elements are added always to the end of the vector. No attempt of reusing previously deleted element is done. | |
static EdgeIterator | AddEdge (MeshType &m, VertexPointer v0, VertexPointer v1) |
static EdgeIterator | AddEdge (MeshType &m, size_t v0, size_t v1) |
static EdgeIterator | AddEdge (MeshType &m, CoordType p0, CoordType p1) |
static EdgeIterator | AddEdges (MeshType &m, size_t n) |
static EdgeIterator | AddEdges (MeshType &m, size_t n, std::vector< EdgePointer * > &local_vec) |
static HEdgeIterator | AddHEdges (MeshType &m, size_t n, PointerUpdater< HEdgePointer > &pu) |
static HEdgeIterator | AddHEdges (MeshType &m, size_t n) |
static HEdgeIterator | AddHEdges (MeshType &m, size_t n, std::vector< HEdgePointer * > &local_vec) |
static FaceIterator | AddFace (MeshType &m, VertexPointer v0, VertexPointer v1, VertexPointer v2) |
static FaceIterator | AddFace (MeshType &m, size_t v0, size_t v1, size_t v2) |
static FaceIterator | AddFace (MeshType &m, CoordType p0, CoordType p1, CoordType p2) |
static FaceIterator | AddQuadFace (MeshType &m, VertexPointer v0, VertexPointer v1, VertexPointer v2, VertexPointer v3) |
static FaceIterator | AddFaces (MeshType &m, size_t n) |
Function to add n faces to the mesh. First wrapper, with no parameters. | |
static FaceIterator | AddFaces (MeshType &m, size_t n, std::vector< FacePointer * > &local_vec) |
Function to add n faces to the mesh. Second Wrapper, with a vector of face pointer to be updated. | |
static FaceIterator | AddFaces (MeshType &m, size_t n, PointerUpdater< FacePointer > &pu) |
Function to add n faces to the mesh. This is the only full featured function that is able to manage correctly all the official internal pointers of the mesh (like the VF and FF adjacency relations) | |
static TetraIterator | AddTetras (MeshType &m, size_t n, PointerUpdater< TetraPointer > &pu) |
Function to add n tetras to the mesh. This is the only full featured function that is able to manage correctly all the official internal pointers of the mesh (like the VT and TT adjacency relations) | |
static TetraIterator | AddTetra (MeshType &m, VertexPointer v0, VertexPointer v1, VertexPointer v2, VertexPointer v3) |
static TetraIterator | AddTetra (MeshType &m, const size_t v0, const size_t v1, const size_t v2, const size_t v3) |
static TetraIterator | AddTetra (MeshType &m, const CoordType &p0, const CoordType &p1, const CoordType &p2, const CoordType &p3) |
static TetraIterator | AddTetras (MeshType &m, size_t n) |
Function to add n faces to the mesh. First wrapper, with no parameters. | |
static TetraIterator | AddTetras (MeshType &m, size_t n, std::vector< TetraPointer * > &local_vec) |
Function to add n faces to the mesh. Second Wrapper, with a vector of face pointer to be updated. | |
static void | DeleteFace (MeshType &m, FaceType &f) |
static void | DeleteVertex (MeshType &m, VertexType &v) |
static void | DeleteEdge (MeshType &m, EdgeType &e) |
static void | DeleteHEdge (MeshType &m, HEdgeType &h) |
static void | DeleteTetra (MeshType &m, TetraType &t) |
static void | CompactVertexVector (MeshType &m, PointerUpdater< VertexPointer > &pu) |
Compact vector of vertices removing deleted elements. Deleted elements are put to the end of the vector and the vector is resized. Order between elements is preserved but not their position (hence the PointerUpdater) After calling this function the IsD() test in the scanning a vector, is no more necessary. | |
static void | CompactVertexVector (MeshType &m) |
Wrapper without the PointerUpdater. | |
static void | CompactEdgeVector (MeshType &m, PointerUpdater< EdgePointer > &pu) |
Compact vector of edges removing deleted elements. | |
static void | CompactEdgeVector (MeshType &m) |
Wrapper without the PointerUpdater. | |
static void | CompactFaceVector (MeshType &m, PointerUpdater< FacePointer > &pu) |
Compact face vector by removing deleted elements. | |
static void | CompactFaceVector (MeshType &m) |
Wrapper without the PointerUpdater. | |
static void | CompactTetraVector (MeshType &m, PointerUpdater< TetraPointer > &pu) |
Compact tetra vector by removing deleted elements. | |
static void | CompactTetraVector (MeshType &m) |
Wrapper without the PointerUpdater. | |
template<class ATTR_TYPE > | |
static bool | IsValidHandle (MeshType &m, const typename MeshType::template PerVertexAttributeHandle< ATTR_TYPE > &a) |
Check if an handle to a Per-Vertex Attribute is valid. | |
template<class ATTR_TYPE > | |
static MeshType::template PerVertexAttributeHandle < ATTR_TYPE > | AddPerVertexAttribute (MeshType &m, std::string name) |
Add a Per-Vertex Attribute of the given ATTR_TYPE with the given name. | |
template<class ATTR_TYPE > | |
static MeshType::template PerVertexAttributeHandle < ATTR_TYPE > | GetPerVertexAttribute (MeshType &m, std::string name=std::string("")) |
gives a handle to a per-vertex attribute with a given name and ATTR_TYPE | |
template<class ATTR_TYPE > | |
static MeshType::template PerVertexAttributeHandle < ATTR_TYPE > | FindPerVertexAttribute (MeshType &m, const std::string &name) |
Try to retrieve an handle to an attribute with a given name and ATTR_TYPE. | |
template<class ATTR_TYPE > | |
static void | GetAllPerVertexAttribute (MeshType &m, std::vector< std::string > &all) |
query the mesh for all the attributes per vertex | |
template<class ATTR_TYPE > | |
static void | DeletePerVertexAttribute (MeshType &m, typename MeshType::template PerVertexAttributeHandle< ATTR_TYPE > &h) |
If the per-vertex attribute exists, delete it. | |
template<class ATTR_TYPE > | |
static bool | IsValidHandle (MeshType &m, const typename MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > &a) |
Per Edge Attributes. | |
template<class ATTR_TYPE > | |
static MeshType::template PerEdgeAttributeHandle < ATTR_TYPE > | GetPerEdgeAttribute (MeshType &m, std::string name=std::string("")) |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE | |
template<class ATTR_TYPE > | |
static void | DeletePerEdgeAttribute (MeshType &m, typename MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > &h) |
If the per-edge attribute exists, delete it. | |
template<class ATTR_TYPE > | |
static bool | IsValidHandle (MeshType &m, const typename MeshType::template PerFaceAttributeHandle< ATTR_TYPE > &a) |
Per Face Attributes. | |
template<class ATTR_TYPE > | |
static MeshType::template PerFaceAttributeHandle < ATTR_TYPE > | GetPerFaceAttribute (MeshType &m, std::string name=std::string("")) |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE | |
template<class ATTR_TYPE > | |
static void | DeletePerFaceAttribute (MeshType &m, typename MeshType::template PerFaceAttributeHandle< ATTR_TYPE > &h) |
If the per-face attribute exists, delete it. | |
template<class ATTR_TYPE > | |
static bool | IsValidHandle (MeshType &m, const typename MeshType::template PerTetraAttributeHandle< ATTR_TYPE > &a) |
Per Tetra Attributes. | |
template<class ATTR_TYPE > | |
static MeshType::template PerTetraAttributeHandle < ATTR_TYPE > | GetPerTetraAttribute (MeshType &m, std::string name=std::string("")) |
gives a handle to a per-tetra attribute with a given name and ATTR_TYPE | |
template<class ATTR_TYPE > | |
static void | DeletePerTetraAttribute (MeshType &m, typename MeshType::template PerTetraAttributeHandle< ATTR_TYPE > &h) |
If the per-face attribute exists, delete it. | |
template<class ATTR_TYPE > | |
static bool | IsValidHandle (MeshType &m, const typename MeshType::template PerMeshAttributeHandle< ATTR_TYPE > &a) |
Per Mesh Attributes. | |
template<class ATTR_TYPE > | |
static MeshType::template PerMeshAttributeHandle < ATTR_TYPE > | GetPerMeshAttribute (MeshType &m, std::string name=std::string("")) |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE | |
template<class ATTR_TYPE > | |
static void | DeletePerMeshAttribute (MeshType &m, typename MeshType::template PerMeshAttributeHandle< ATTR_TYPE > &h) |
If the per-mesh attribute exists, delete it. | |
Class to safely add and delete elements in a mesh.
Adding elements to a mesh, like faces and vertices can involve the reallocation of the vectors of the involved elements. This class provide the only safe methods to add elements. It also provide an accessory class vcg::tri::PointerUpdater for updating pointers to mesh elements that are kept by the user.
Definition at line 93 of file allocate.h.
|
inlinestatic |
Function to add a single edge to the mesh. and initializing it with two VertexPointer
Definition at line 366 of file allocate.h.
|
inlinestatic |
Function to add a single edge to the mesh. and initializing it with two indexes to the vertexes
Definition at line 376 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with the three given coords
Definition at line 387 of file allocate.h.
|
inlinestatic |
Add n edges to the mesh. Function to add n edges to the mesh. The elements are added always to the end of the vector. No attempt of reusing previously deleted element is done.
m | the mesh to be modified |
n | the number of elements to be added |
pu | a PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding. |
the | iterator to the first element added. |
Definition at line 312 of file allocate.h.
|
inlinestatic |
Function to add n edges to the mesh. First wrapper, with no parameters
Definition at line 401 of file allocate.h.
|
inlinestatic |
Function to add n edges to the mesh. Second Wrapper, with a vector of vertex pointers to be updated.
Definition at line 410 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with the three given VertexPointers
Definition at line 518 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with three indexes
Definition at line 536 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with the three given coords
Definition at line 546 of file allocate.h.
|
inlinestatic |
Function to add n faces to the mesh. First wrapper, with no parameters.
Definition at line 594 of file allocate.h.
|
inlinestatic |
Function to add n faces to the mesh. Second Wrapper, with a vector of face pointer to be updated.
Definition at line 603 of file allocate.h.
|
inlinestatic |
Function to add n faces to the mesh. This is the only full featured function that is able to manage correctly all the official internal pointers of the mesh (like the VF and FF adjacency relations)
m | the mesh to be modified |
n | the number of elements to be added |
pu | a PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding. |
the | iterator to the first element added. |
Definition at line 626 of file allocate.h.
|
inlinestatic |
Function to add n halfedges to the mesh. The second parameter hold a vector of pointers to pointer to elements of the mesh that should be updated after a possible vector realloc.
m | the mesh to be modified |
n | the number of elements to be added |
pu | a PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding. |
the | iterator to the first element added. |
Definition at line 432 of file allocate.h.
|
inlinestatic |
Function to add n vertices to the mesh. First wrapper, with no parameters
Definition at line 494 of file allocate.h.
|
inlinestatic |
Function to add n vertices to the mesh. Second Wrapper, with a vector of vertex pointers to be updated.
Definition at line 503 of file allocate.h.
|
inlinestatic |
Add a Per-Vertex Attribute of the given ATTR_TYPE with the given name.
No attribute with that name must exists (even of different type)
Definition at line 1444 of file allocate.h.
|
inlinestatic |
Function to add a quad face to the mesh and initializing it with the four given VertexPointers
Note that this function add a single polygonal face if the mesh has polygonal info or two tris with the corresponding faux bit set in the standard common case of a triangular mesh.
Definition at line 564 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with the three given VertexPointers
Definition at line 774 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with three indexes
Definition at line 799 of file allocate.h.
|
inlinestatic |
Function to add a face to the mesh and initializing it with the three given coords
Definition at line 812 of file allocate.h.
|
inlinestatic |
Function to add n tetras to the mesh. This is the only full featured function that is able to manage correctly all the official internal pointers of the mesh (like the VT and TT adjacency relations)
m | the mesh to be modified |
n | the number of elements to be added |
pu | a PointerUpdater initialized so that it can be used to update pointers to tetras that could have become invalid after this adding. |
the | iterator to the first element added. |
Definition at line 704 of file allocate.h.
|
inlinestatic |
Function to add n faces to the mesh. First wrapper, with no parameters.
Definition at line 859 of file allocate.h.
|
inlinestatic |
Function to add n faces to the mesh. Second Wrapper, with a vector of face pointer to be updated.
Definition at line 868 of file allocate.h.
|
inlinestatic |
Wrapper to AddVertices() to add a single vertex with given coords.
Definition at line 274 of file allocate.h.
|
inlinestatic |
Wrapper to AddVertices() to add a single vertex with given coords and normal.
Definition at line 283 of file allocate.h.
|
inlinestatic |
Wrapper to AddVertices() to add a single vertex with given coords and color.
Definition at line 293 of file allocate.h.
|
inlinestatic |
Add n vertices to the mesh. Function to add n vertices to the mesh. The elements are added always to the end of the vector. No attempt of reusing previously deleted element is done.
m | the mesh to be modified |
n | the number of elements to be added |
pu | a PointerUpdater initialized so that it can be used to update pointers to vertices that could have become invalid after this adding. |
the | iterator to the first element added. |
Definition at line 186 of file allocate.h.
|
inlinestatic |
Wrapper to AddVertices(); no PointerUpdater.
Definition at line 253 of file allocate.h.
|
inlinestatic |
Wrapper to AddVertices() no PointerUpdater but a vector of VertexPointer pointers to be updated.
Definition at line 261 of file allocate.h.
|
inlinestatic |
Compact vector of edges removing deleted elements.
Deleted elements are put to the end of the vector and the vector is resized. Order between elements is preserved but not their position (hence the PointerUpdater) After calling this function the IsD()
test in the scanning a vector, is no more necessary.
Definition at line 1083 of file allocate.h.
|
inlinestatic |
Wrapper without the PointerUpdater.
Definition at line 1179 of file allocate.h.
|
inlinestatic |
Compact face vector by removing deleted elements.
Deleted elements are put to the end of the vector and the vector is resized. Order between elements is preserved, but not their position (hence the PointerUpdater) Immediately after calling this function the IsD()
test during the scanning a vector, is no more necessary.
Definition at line 1192 of file allocate.h.
|
inlinestatic |
Wrapper without the PointerUpdater.
Definition at line 1298 of file allocate.h.
|
inlinestatic |
Compact tetra vector by removing deleted elements.
Deleted elements are put to the end of the vector and the vector is resized. Order between elements is preserved, but not their position (hence the PointerUpdater) Immediately after calling this function the IsD()
test during the scanning a vector, is no more necessary.
Definition at line 1311 of file allocate.h.
|
inlinestatic |
Wrapper without the PointerUpdater.
Definition at line 1417 of file allocate.h.
|
inlinestatic |
Compact vector of vertices removing deleted elements. Deleted elements are put to the end of the vector and the vector is resized. Order between elements is preserved but not their position (hence the PointerUpdater) After calling this function the IsD()
test in the scanning a vector, is no more necessary.
Definition at line 1045 of file allocate.h.
|
inlinestatic |
Wrapper without the PointerUpdater.
Definition at line 1070 of file allocate.h.
|
inlinestatic |
Function to delete an edge from the mesh. NOTE: THIS FUNCTION ALSO UPDATE en
Definition at line 907 of file allocate.h.
|
inlinestatic |
Function to delete a face from the mesh. NOTE: THIS FUNCTION ALSO UPDATE FN
Definition at line 884 of file allocate.h.
|
inlinestatic |
Function to delete a hedge from the mesh. NOTE: THIS FUNCTION ALSO UPDATE en
Definition at line 918 of file allocate.h.
|
inlinestatic |
If the per-edge attribute exists, delete it.
Definition at line 1674 of file allocate.h.
|
inlinestatic |
If the per-face attribute exists, delete it.
Definition at line 1794 of file allocate.h.
|
inlinestatic |
If the per-mesh attribute exists, delete it.
Definition at line 2032 of file allocate.h.
|
inlinestatic |
If the per-face attribute exists, delete it.
Definition at line 1918 of file allocate.h.
|
inlinestatic |
If the per-vertex attribute exists, delete it.
Definition at line 1548 of file allocate.h.
|
inlinestatic |
Function to delete a tetra from the mesh. NOTE: THIS FUNCTION ALSO UPDATE tn
Definition at line 929 of file allocate.h.
|
inlinestatic |
Function to delete a vertex from the mesh. NOTE: THIS FUNCTION ALSO UPDATE vn
Definition at line 896 of file allocate.h.
|
inlinestatic |
Try to retrieve an handle to an attribute with a given name and ATTR_TYPE.
Definition at line 1491 of file allocate.h.
|
inlinestatic |
query the mesh for all the attributes per vertex
Definition at line 1517 of file allocate.h.
|
inlinestatic |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE
Definition at line 1619 of file allocate.h.
|
inlinestatic |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE
Definition at line 1743 of file allocate.h.
|
inlinestatic |
gives a handle to a per-edge attribute with a given name and ATTR_TYPE
Definition at line 1985 of file allocate.h.
|
inlinestatic |
gives a handle to a per-tetra attribute with a given name and ATTR_TYPE
Definition at line 1862 of file allocate.h.
|
inlinestatic |
gives a handle to a per-vertex attribute with a given name and ATTR_TYPE
Definition at line 1476 of file allocate.h.
|
inlinestatic |
Check if an handle to a Per-Vertex Attribute is valid.
Definition at line 1430 of file allocate.h.
|
inlinestatic |
Per Edge Attributes.
Definition at line 1576 of file allocate.h.
|
inlinestatic |
Per Face Attributes.
Definition at line 1700 of file allocate.h.
|
inlinestatic |
Per Tetra Attributes.
Definition at line 1819 of file allocate.h.
|
inlinestatic |
Per Mesh Attributes.
Definition at line 1950 of file allocate.h.