$darkmode
VCG Library
Classes | Public Types | Static Public Member Functions | List of all members
vcg::tri::Allocator< MeshType > Class Template Reference

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...
 

Public Types

typedef MeshType::VertexType VertexType
 
typedef MeshType::VertexPointer VertexPointer
 
typedef MeshType::VertexIterator VertexIterator
 
typedef MeshType::VertContainer VertContainer
 
typedef MeshType::EdgeType EdgeType
 
typedef MeshType::EdgePointer EdgePointer
 
typedef MeshType::EdgeIterator EdgeIterator
 
typedef MeshType::EdgeContainer EdgeContainer
 
typedef MeshType::FaceType FaceType
 
typedef MeshType::FacePointer FacePointer
 
typedef MeshType::FaceIterator FaceIterator
 
typedef MeshType::FaceContainer FaceContainer
 
typedef MeshType::HEdgeType HEdgeType
 
typedef MeshType::HEdgePointer HEdgePointer
 
typedef MeshType::HEdgeIterator HEdgeIterator
 
typedef MeshType::HEdgeContainer HEdgeContainer
 
typedef MeshType::TetraType TetraType
 
typedef MeshType::TetraPointer TetraPointer
 
typedef MeshType::TetraIterator TetraIterator
 
typedef MeshType::TetraContainer TetraContainer
 
typedef MeshType::CoordType CoordType
 
typedef MeshType::PointerToAttribute PointerToAttribute
 
typedef std::set< PointerToAttribute >::iterator AttrIterator
 
typedef std::set< PointerToAttribute >::const_iterator AttrConstIterator
 
typedef std::set< PointerToAttribute >::iterator PAIte
 

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. More...
 
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 AddVertices (MeshType &m, const Eigen::MatrixXf &vm)
 Wrapper to AddVertices() to add an eigen matrix of (vn,3) it returns the iterator to the first vertex added.
 
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. More...
 
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, const Eigen::MatrixXi &fm)
 Function to add n faces to the mesh getting indexes from a (fn, 3) eigen matrix of int .
 
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) More...
 
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) More...
 
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 PermutateVertexVector (MeshType &m, PointerUpdater< VertexPointer > &pu)
 
static void CompactEveryVector (MeshType &m)
 
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. More...
 
static void CompactVertexVector (MeshType &m)
 Wrapper without the PointerUpdater.
 
static void CompactEdgeVector (MeshType &m, PointerUpdater< EdgePointer > &pu)
 Compact vector of edges removing deleted elements. More...
 
static void CompactEdgeVector (MeshType &m)
 Wrapper without the PointerUpdater.
 
static void CompactFaceVector (MeshType &m, PointerUpdater< FacePointer > &pu)
 Compact face vector by removing deleted elements. More...
 
static void CompactFaceVector (MeshType &m)
 Wrapper without the PointerUpdater.
 
static void CompactTetraVector (MeshType &m, PointerUpdater< TetraPointer > &pu)
 Compact tetra vector by removing deleted elements. More...
 
static void CompactTetraVector (MeshType &m)
 Wrapper without the PointerUpdater.
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template PerVertexAttributeHandle< ATTR_TYPE > &a)
 Checks if a handle to a Per-Vertex Attribute is valid.
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template ConstPerVertexAttributeHandle< ATTR_TYPE > &a)
 Checks if a const 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. More...
 
template<class ATTR_TYPE >
static MeshType::template PerVertexAttributeHandle< ATTR_TYPE > AddPerVertexAttribute (MeshType &m)
 
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 More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerVertexAttributeHandle< ATTR_TYPE > GetPerVertexAttribute (const MeshType &m, std::string name=std::string(""))
 gives a const handle to a per-vertex attribute with a given name and ATTR_TYPE More...
 
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. More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerVertexAttributeHandle< ATTR_TYPE > FindPerVertexAttribute (const MeshType &m, const std::string &name)
 Try to retrieve a const handle to an attribute with a given name and ATTR_TYPE, from the given const mesh. If not found, an invalid handle will be returned. Check it with the function IsValidHandle.
 
template<class ATTR_TYPE >
static void GetAllPerVertexAttribute (const MeshType &m, std::vector< std::string > &all)
 query the mesh for all the attributes per vertex More...
 
template<class ATTR_TYPE >
static void ClearPerVertexAttribute (MeshType &m, typename MeshType::template PerVertexAttributeHandle< ATTR_TYPE > &h, const ATTR_TYPE &initVal=ATTR_TYPE())
 
template<class ATTR_TYPE >
static void DeletePerVertexAttribute (MeshType &m, typename MeshType::template PerVertexAttributeHandle< ATTR_TYPE > &h)
 If the per-vertex attribute exists, delete it.
 
static bool DeletePerVertexAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > &a)
 Per Edge Attributes.
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template ConstPerEdgeAttributeHandle< ATTR_TYPE > &a)
 
template<class ATTR_TYPE >
static MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > AddPerEdgeAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > AddPerEdgeAttribute (MeshType &m)
 
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 More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerEdgeAttributeHandle< ATTR_TYPE > GetPerEdgeAttribute (const MeshType &m, std::string name=std::string(""))
 
template<class ATTR_TYPE >
static MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > FindPerEdgeAttribute (MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static MeshType::template ConstPerEdgeAttributeHandle< ATTR_TYPE > FindPerEdgeAttribute (const MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static void GetAllPerEdgeAttribute (const MeshType &m, std::vector< std::string > &all)
 
template<class ATTR_TYPE >
static void DeletePerEdgeAttribute (MeshType &m, typename MeshType::template PerEdgeAttributeHandle< ATTR_TYPE > &h)
 If the per-edge attribute exists, delete it.
 
static bool DeletePerEdgeAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template PerFaceAttributeHandle< ATTR_TYPE > &a)
 Per Face Attributes. More...
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template ConstPerFaceAttributeHandle< ATTR_TYPE > &a)
 Checks if a const handle to a Per-Face attribute is valid.
 
template<class ATTR_TYPE >
static MeshType::template PerFaceAttributeHandle< ATTR_TYPE > AddPerFaceAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static MeshType::template PerFaceAttributeHandle< ATTR_TYPE > AddPerFaceAttribute (MeshType &m)
 
template<class ATTR_TYPE >
static MeshType::template PerFaceAttributeHandle< ATTR_TYPE > GetPerFaceAttribute (MeshType &m, std::string name=std::string(""))
 gives a handle to a per-face attribute with a given name and ATTR_TYPE More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerFaceAttributeHandle< ATTR_TYPE > GetPerFaceAttribute (const MeshType &m, std::string name=std::string(""))
 gives a handle to a per-face attribute with a given name and ATTR_TYPE More...
 
template<class ATTR_TYPE >
static MeshType::template PerFaceAttributeHandle< ATTR_TYPE > FindPerFaceAttribute (MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static MeshType::template ConstPerFaceAttributeHandle< ATTR_TYPE > FindPerFaceAttribute (const MeshType &m, const std::string &name)
 Try to retrieve a const handle to an attribute with a given name and ATTR_TYPE, from the given const mesh. If not found, an invalid handle will be returned. Check it with the function IsValidHandle.
 
template<class ATTR_TYPE >
static void GetAllPerFaceAttribute (const MeshType &m, std::vector< std::string > &all)
 
template<class ATTR_TYPE >
static void DeletePerFaceAttribute (MeshType &m, typename MeshType::template PerFaceAttributeHandle< ATTR_TYPE > &h)
 If the per-face attribute exists, delete it.
 
static bool DeletePerFaceAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template PerTetraAttributeHandle< ATTR_TYPE > &a)
 Per Tetra Attributes.
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template ConstPerTetraAttributeHandle< ATTR_TYPE > &a)
 
template<class ATTR_TYPE >
static MeshType::template PerTetraAttributeHandle< ATTR_TYPE > AddPerTetraAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static MeshType::template PerTetraAttributeHandle< ATTR_TYPE > AddPerTetraAttribute (MeshType &m)
 
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 More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerTetraAttributeHandle< ATTR_TYPE > GetPerTetraAttribute (const MeshType &m, std::string name=std::string(""))
 
template<class ATTR_TYPE >
static MeshType::template PerTetraAttributeHandle< ATTR_TYPE > FindPerTetraAttribute (MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static MeshType::template ConstPerTetraAttributeHandle< ATTR_TYPE > FindPerTetraAttribute (const MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static void GetAllPerTetraAttribute (const MeshType &m, std::vector< std::string > &all)
 
template<class ATTR_TYPE >
static void DeletePerTetraAttribute (MeshType &m, typename MeshType::template PerTetraAttributeHandle< ATTR_TYPE > &h)
 If the per-face attribute exists, delete it.
 
static bool DeletePerTetraAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template PerMeshAttributeHandle< ATTR_TYPE > &a)
 Per Mesh Attributes.
 
template<class ATTR_TYPE >
static bool IsValidHandle (const MeshType &m, const typename MeshType::template ConstPerMeshAttributeHandle< ATTR_TYPE > &a)
 
template<class ATTR_TYPE >
static MeshType::template PerMeshAttributeHandle< ATTR_TYPE > AddPerMeshAttribute (MeshType &m, std::string name)
 
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 More...
 
template<class ATTR_TYPE >
static MeshType::template ConstPerMeshAttributeHandle< ATTR_TYPE > GetPerMeshAttribute (const MeshType &m, std::string name=std::string(""))
 
template<class ATTR_TYPE >
static MeshType::template PerMeshAttributeHandle< ATTR_TYPE > FindPerMeshAttribute (MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static MeshType::template ConstPerMeshAttributeHandle< ATTR_TYPE > FindPerMeshAttribute (const MeshType &m, const std::string &name)
 
template<class ATTR_TYPE >
static void GetAllPerMeshAttribute (const MeshType &m, std::vector< std::string > &all)
 
template<class ATTR_TYPE >
static void DeletePerMeshAttribute (MeshType &m, typename MeshType::template PerMeshAttributeHandle< ATTR_TYPE > &h)
 If the per-mesh attribute exists, delete it.
 
static bool DeletePerMeshAttribute (MeshType &m, std::string name)
 
template<class ATTR_TYPE >
static void FixPaddedPerVertexAttribute (MeshType &m, PointerToAttribute &pa)
 
template<class ATTR_TYPE >
static void FixPaddedPerEdgeAttribute (MeshType &m, PointerToAttribute &pa)
 
template<class ATTR_TYPE >
static void FixPaddedPerFaceAttribute (MeshType &m, PointerToAttribute &pa)
 
template<class ATTR_TYPE >
static void FixPaddedPerTetraAttribute (MeshType &m, PointerToAttribute &pa)
 
template<class ATTR_TYPE >
static void FixPaddedPerMeshAttribute (MeshType &, PointerToAttribute &pa)
 

Detailed Description

template<class MeshType>
class vcg::tri::Allocator< MeshType >

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.

Member Function Documentation

◆ AddEdge() [1/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdge ( MeshType &  m,
CoordType  p0,
CoordType  p1 
)
inlinestatic

Function to add a face to the mesh and initializing it with the three given coords

◆ AddEdge() [2/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdge ( MeshType &  m,
size_t  v0,
size_t  v1 
)
inlinestatic

Function to add a single edge to the mesh. and initializing it with two indexes to the vertexes

◆ AddEdge() [3/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdge ( MeshType &  m,
VertexPointer  v0,
VertexPointer  v1 
)
inlinestatic

Function to add a single edge to the mesh. and initializing it with two VertexPointer

◆ AddEdges() [1/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdges ( MeshType &  m,
size_t  n 
)
inlinestatic

Function to add n edges to the mesh. First wrapper, with no parameters

◆ AddEdges() [2/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdges ( MeshType &  m,
size_t  n,
PointerUpdater< EdgePointer > &  pu 
)
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.

See also
PointerUpdater
Parameters
mthe mesh to be modified
nthe number of elements to be added
pua PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding.
Return values
theiterator to the first element added.

◆ AddEdges() [3/3]

template<class MeshType >
static EdgeIterator vcg::tri::Allocator< MeshType >::AddEdges ( MeshType &  m,
size_t  n,
std::vector< EdgePointer * > &  local_vec 
)
inlinestatic

Function to add n edges to the mesh. Second Wrapper, with a vector of vertex pointers to be updated.

◆ AddFace() [1/3]

template<class MeshType >
static FaceIterator vcg::tri::Allocator< MeshType >::AddFace ( MeshType &  m,
CoordType  p0,
CoordType  p1,
CoordType  p2 
)
inlinestatic

Function to add a face to the mesh and initializing it with the three given coords

◆ AddFace() [2/3]

template<class MeshType >
static FaceIterator vcg::tri::Allocator< MeshType >::AddFace ( MeshType &  m,
size_t  v0,
size_t  v1,
size_t  v2 
)
inlinestatic

Function to add a face to the mesh and initializing it with three indexes

◆ AddFace() [3/3]

template<class MeshType >
static FaceIterator vcg::tri::Allocator< MeshType >::AddFace ( MeshType &  m,
VertexPointer  v0,
VertexPointer  v1,
VertexPointer  v2 
)
inlinestatic

Function to add a face to the mesh and initializing it with the three given VertexPointers

◆ AddFaces()

template<class MeshType >
static FaceIterator vcg::tri::Allocator< MeshType >::AddFaces ( MeshType &  m,
size_t  n,
PointerUpdater< FacePointer > &  pu 
)
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)

Warning
Calling this function can cause the invalidation of any not-managed FacePointer just because we resize the face vector. If you have such pointers you need to update them by mean of the PointerUpdater object.
See also
PointerUpdater
Parameters
mthe mesh to be modified
nthe number of elements to be added
pua PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding.
Return values
theiterator to the first element added.

◆ AddHEdges() [1/3]

template<class MeshType >
static HEdgeIterator vcg::tri::Allocator< MeshType >::AddHEdges ( MeshType &  m,
size_t  n 
)
inlinestatic

Function to add n vertices to the mesh. First wrapper, with no parameters

◆ AddHEdges() [2/3]

template<class MeshType >
static HEdgeIterator vcg::tri::Allocator< MeshType >::AddHEdges ( MeshType &  m,
size_t  n,
PointerUpdater< HEdgePointer > &  pu 
)
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.

See also
PointerUpdater
Parameters
mthe mesh to be modified
nthe number of elements to be added
pua PointerUpdater initialized so that it can be used to update pointers to edges that could have become invalid after this adding.
Return values
theiterator to the first element added.

◆ AddHEdges() [3/3]

template<class MeshType >
static HEdgeIterator vcg::tri::Allocator< MeshType >::AddHEdges ( MeshType &  m,
size_t  n,
std::vector< HEdgePointer * > &  local_vec 
)
inlinestatic

Function to add n vertices to the mesh. Second Wrapper, with a vector of vertex pointers to be updated.

◆ AddPerVertexAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerVertexAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::AddPerVertexAttribute ( MeshType &  m,
std::string  name 
)
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)

◆ AddQuadFace()

template<class MeshType >
static FaceIterator vcg::tri::Allocator< MeshType >::AddQuadFace ( MeshType &  m,
VertexPointer  v0,
VertexPointer  v1,
VertexPointer  v2,
VertexPointer  v3 
)
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.

◆ AddTetra() [1/3]

template<class MeshType >
static TetraIterator vcg::tri::Allocator< MeshType >::AddTetra ( MeshType &  m,
const CoordType &  p0,
const CoordType &  p1,
const CoordType &  p2,
const CoordType &  p3 
)
inlinestatic

Function to add a face to the mesh and initializing it with the three given coords

◆ AddTetra() [2/3]

template<class MeshType >
static TetraIterator vcg::tri::Allocator< MeshType >::AddTetra ( MeshType &  m,
const size_t  v0,
const size_t  v1,
const size_t  v2,
const size_t  v3 
)
inlinestatic

Function to add a face to the mesh and initializing it with three indexes

◆ AddTetra() [3/3]

template<class MeshType >
static TetraIterator vcg::tri::Allocator< MeshType >::AddTetra ( MeshType &  m,
VertexPointer  v0,
VertexPointer  v1,
VertexPointer  v2,
VertexPointer  v3 
)
inlinestatic

Function to add a face to the mesh and initializing it with the three given VertexPointers

◆ AddTetras()

template<class MeshType >
static TetraIterator vcg::tri::Allocator< MeshType >::AddTetras ( MeshType &  m,
size_t  n,
PointerUpdater< TetraPointer > &  pu 
)
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)

Warning
Calling this function can cause the invalidation of any not-managed TetraPointer just because we resize the face vector. If you have such pointers you need to update them by mean of the PointerUpdater object.
See also
PointerUpdater
Parameters
mthe mesh to be modified
nthe number of elements to be added
pua PointerUpdater initialized so that it can be used to update pointers to tetras that could have become invalid after this adding.
Return values
theiterator to the first element added.

◆ AddVertices()

template<class MeshType >
static VertexIterator vcg::tri::Allocator< MeshType >::AddVertices ( MeshType &  m,
size_t  n,
PointerUpdater< VertexPointer > &  pu 
)
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.

See also
PointerUpdater
Parameters
mthe mesh to be modified
nthe number of elements to be added
pua PointerUpdater initialized so that it can be used to update pointers to vertices that could have become invalid after this adding.
Return values
theiterator to the first element added.

◆ CompactEdgeVector()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::CompactEdgeVector ( MeshType &  m,
PointerUpdater< EdgePointer > &  pu 
)
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.

Warning
It should not be called when TemporaryData is active (but works correctly if attributes are present)

◆ CompactFaceVector()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::CompactFaceVector ( MeshType &  m,
PointerUpdater< FacePointer > &  pu 
)
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.

Warning
It should not be called when some TemporaryData is active (but works correctly if attributes are present)

◆ CompactTetraVector()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::CompactTetraVector ( MeshType &  m,
PointerUpdater< TetraPointer > &  pu 
)
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.

Warning
It should not be called when some TemporaryData is active (but works correctly if attributes are present)

◆ CompactVertexVector()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::CompactVertexVector ( MeshType &  m,
PointerUpdater< VertexPointer > &  pu 
)
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.

Warning
It should not be called when TemporaryData is active (but works correctly if attributes are present)

◆ DeleteEdge()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::DeleteEdge ( MeshType &  m,
EdgeType &  e 
)
inlinestatic

Function to delete an edge from the mesh. NOTE: THIS FUNCTION ALSO UPDATE en

◆ DeleteFace()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::DeleteFace ( MeshType &  m,
FaceType &  f 
)
inlinestatic

Function to delete a face from the mesh. NOTE: THIS FUNCTION ALSO UPDATE FN

◆ DeleteHEdge()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::DeleteHEdge ( MeshType &  m,
HEdgeType &  h 
)
inlinestatic

Function to delete a hedge from the mesh. NOTE: THIS FUNCTION ALSO UPDATE en

◆ DeleteTetra()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::DeleteTetra ( MeshType &  m,
TetraType &  t 
)
inlinestatic

Function to delete a tetra from the mesh. NOTE: THIS FUNCTION ALSO UPDATE tn

◆ DeleteVertex()

template<class MeshType >
static void vcg::tri::Allocator< MeshType >::DeleteVertex ( MeshType &  m,
VertexType &  v 
)
inlinestatic

Function to delete a vertex from the mesh. NOTE: THIS FUNCTION ALSO UPDATE vn

◆ FindPerVertexAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerVertexAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::FindPerVertexAttribute ( MeshType &  m,
const std::string &  name 
)
inlinestatic

Try to retrieve an handle to an attribute with a given name and ATTR_TYPE.

Returns
a invalid handle if no attribute with that name and type exists.

◆ GetAllPerVertexAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static void vcg::tri::Allocator< MeshType >::GetAllPerVertexAttribute ( const MeshType &  m,
std::vector< std::string > &  all 
)
inlinestatic

query the mesh for all the attributes per vertex

Returns
the name of all attributes with a non-empy name.

◆ GetPerEdgeAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerEdgeAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerEdgeAttribute ( MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-edge attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise return a hanlde to a newly created.

◆ GetPerFaceAttribute() [1/2]

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerFaceAttribute ( const MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-face attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise, returns an invalid handle (check it using IsValidHandle).

◆ GetPerFaceAttribute() [2/2]

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerFaceAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerFaceAttribute ( MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-face attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise return a hanlde to a newly created.

◆ GetPerMeshAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerMeshAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerMeshAttribute ( MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-edge attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise return a hanlde to a newly created.

◆ GetPerTetraAttribute()

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerTetraAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerTetraAttribute ( MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-tetra attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise return a hanlde to a newly created.

◆ GetPerVertexAttribute() [1/2]

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerVertexAttribute ( const MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a const handle to a per-vertex attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise, returns an invalid handle (check it using IsValidHandle).

◆ GetPerVertexAttribute() [2/2]

template<class MeshType >
template<class ATTR_TYPE >
static MeshType::template PerVertexAttributeHandle<ATTR_TYPE> vcg::tri::Allocator< MeshType >::GetPerVertexAttribute ( MeshType &  m,
std::string  name = std::string("") 
)
inlinestatic

gives a handle to a per-vertex attribute with a given name and ATTR_TYPE

Returns
a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it. Otherwise return a hanlde to a newly created.

◆ IsValidHandle()

template<class MeshType >
template<class ATTR_TYPE >
static bool vcg::tri::Allocator< MeshType >::IsValidHandle ( const MeshType &  m,
const typename MeshType::template PerFaceAttributeHandle< ATTR_TYPE > &  a 
)
inlinestatic

Per Face Attributes.

Checks if a handle to a Per-Face attribute is valid


The documentation for this class was generated from the following file: