Visual Computing Library
All Classes Functions Variables Typedefs Enumerations Friends Modules Pages Concepts
vcl::mesh::VertexContainer< T > Class Template Reference

The Vertex Container class, will be used when the template argument given to the Mesh is a Vertex. More...

#include <vclib/mesh/containers/vertex_container.h>

Inheritance diagram for vcl::mesh::VertexContainer< T >:

Public Types

using Vertex = T
 
using VertexType = T
 
using VertexIterator = Base::ElementIterator
 
using ConstVertexIterator = Base::ConstElementIterator
 

Public Member Functions

 VertexContainer ()=default
 Empty constructor that creates an empty container of Vertices.
 
const VertexType & vertex (uint i) const
 Returns a const reference of the vertex at the i-th position in the Vertex Container of the Mesh, which will be the vertex having index = i.
 
VertexType & vertex (uint i)
 Returns a reference of the vertex at the i-th position in the Vertex Container of the Mesh, which will be the vertex having index = i.
 
uint vertexNumber () const
 Returns the number of non-deleted vertices contained in the Vertex container of the Mesh.
 
uint vertexContainerSize () const
 Returns the number of vertices (also deleted) contained in the Vertex container of the Mesh.
 
uint deletedVertexNumber () const
 Returns the number of deleted vertices in the Vertex container, that is vertexContainerSize() - vertexNumber().
 
uint addVertex ()
 Add a new vertex into the vertex container, returning the index of the added vertex.
 
uint addVertex (const typename T::CoordType &p)
 Add a new vertex with the given coordinate into the vertex container, returning the id of the added vertex.
 
uint addVertices (uint n)
 Add an arbitrary number of n vertices, returning the id of the first added vertex.
 
template<typename... VC>
uint addVertices (const typename T::CoordType &p, const VC &... v)
 Add an arbitrary number of vertices with the given coordinates, returning the id of the first added vertex.
 
template<vcl::Range R>
requires RangeOf<R, typename T::CoordType>
uint addVertices (R &&range)
 Add an arbitrary number of vertices with the coordinates contained in the given range, returning the id of the first added vertex.
 
void clearVertices ()
 Clears the Vertex container of the Mesh, deleting all the vertices.
 
void resizeVertices (uint n)
 Resizes the Vertex container to contain n vertices.
 
void reserveVertices (uint n)
 Reserve a number of vertices in the container of Vertices. This is useful when you know (or you have an idea) of how much vertices are going to add into a newly or existing mesh. Calling this function before any add_vertex() call will avoid unuseful reallocations of the container, saving execution time.
 
void compactVertices ()
 Compacts the Vertex Container, removing all the vertices marked as deleted. Vertices indices will change accordingly. The function will automatically take care of updating all the Vertex pointers contained in the Mesh.
 
void deleteVertex (uint i)
 Marks as deleted the vertex with the given id.
 
void deleteVertex (const VertexType *v)
 Marks as deleted the given vertex, before asserting that the vertex belongs to this container.
 
uint vertexIndexIfCompact (uint i) const
 This is an utility member function that returns the index of an element if the container would be compact, that is the number of non-deleted elements before the vertex with the given index.
 
std::vector< uintvertexCompactIndices () const
 Returns a vector that tells, for each actual vertex index, the new index that the vertex would have in a compacted container. For each deleted vertex index, the value of the vector will be UINT_NULL.
 
void updateVertexIndices (const std::vector< uint > &newIndices)
 Updates all the indices and pointers of the vertices of this container that are stored in any container of the mesh, according to the mapping stored in the newIndices vector, that tells for each old vertex index, the new vertex index.
 
VertexIterator vertexBegin (bool jumpDeleted=true)
 Returns an iterator to the beginning of the container.
 
VertexIterator vertexEnd ()
 Returns an iterator to the end of the container.
 
ConstVertexIterator vertexBegin (bool jumpDeleted=true) const
 Returns a const iterator to the beginning of the container.
 
ConstVertexIterator vertexEnd () const
 Returns a const iterator to the end of the container.
 
auto vertices (bool jumpDeleted=true)
 Returns a small utility object that allows to iterate over the vertices of the containers, providing two member functions begin() and end().
 
auto vertices (bool jumpDeleted=true) const
 Returns a small utility object that allows to iterate over the vertices of the containers, providing two member functions begin() and end().
 
void enableAllPerVertexOptionalComponents ()
 Enables all the optional components associated to the Vertex type contained in the VertexContainer.
 
void disableAllPerVertexOptionalComponents ()
 Disables all the optional components associated to the Vertex type contained in the VertexContainer.
 
bool isPerVertexAdjacentEdgesEnabled () const
 Checks if the vertex Optional Adjacent Edges component is enabled.
 
void enablePerVertexAdjacentEdges ()
 Enables the Optional Adjacent Edges of the vertex.
 
void disablePerVertexAdjacentEdges ()
 Disables the Optional Adjacent Edges of the vertex.
 
bool isPerVertexAdjacentFacesEnabled () const
 Checks if the vertex Optional Adjacent Faces component is enabled.
 
void enablePerVertexAdjacentFaces ()
 Enables the Optional Adjacent Faces of the vertex.
 
void disablePerVertexAdjacentFaces ()
 Disables the Optional Adjacent Faces of the vertex.
 
bool isPerVertexAdjacentVerticesEnabled () const
 Checks if the vertex Optional Adjacent Vertices component is enabled.
 
void enablePerVertexAdjacentVertices ()
 Enables the Optional Adjacent Vertices of the vertex.
 
void disablePerVertexAdjacentVertices ()
 Disables the Optional Adjacent Vertices of the vertex.
 
bool isPerVertexColorEnabled () const
 Checks if the vertex Optional Color is enabled.
 
void enablePerVertexColor ()
 Enables the Optional Color of the vertex.
 
void disablePerVertexColor ()
 Disables the Optional Color of the vertex.
 
bool isPerVertexMarkEnabled () const
 Checks if the vertex Optional Mark is enabled.
 
void enablePerVertexMark ()
 Enables the Optional Mark of the vertex.
 
void disablePerVertexMark ()
 Container::disableVertexMark disables the Optional Mark of the vertex.
 
bool isPerVertexNormalEnabled () const
 Checks if the vertex Optional Normal is enabled.
 
void enablePerVertexNormal ()
 Enables the Optional Normal of the vertex.
 
void disablePerVertexNormal ()
 Checks if the vertex Optional PrincipalCurvature is enabled.
 
bool isPerVertexPrincipalCurvatureEnabled () const
 Checks if the vertex Optional PrincipalCurvature is enabled.
 
void enablePerVertexPrincipalCurvature ()
 Enables the Optional PrincipalCurvature of the vertex.
 
void disablePerVertexPrincipalCurvature ()
 Disables the Optional PrincipalCurvature of the vertex.
 
bool isPerVertexQualityEnabled () const
 Checks if the vertex Optional Quality is enabled.
 
void enablePerVertexQuality ()
 Enables the Optional Quality of the vertex.
 
void disablePerVertexQuality ()
 Disables the Optional Quality of the vertex.
 
bool isPerVertexTexCoordEnabled () const
 Checks if the vertex Optional TexCoord is enabled.
 
void enablePerVertexTexCoord ()
 Enables the Optional TexCoord of the vertex.
 
void disablePerVertexTexCoord ()
 Disables the Optional TexCoord of the vertex.
 
bool hasPerVertexCustomComponent (const std::string &name) const
 Checks if vertices have a custom component with the given name.
 
std::vector< std::string > perVertexCustomComponentNames () const
 Returns a vector containing all the names of the custom components of any type associated to the Vertex Element.
 
template<typename K >
requires vert::HasCustomComponents<T>
bool isPerVertexCustomComponentOfType (const std::string &name) const
 Checks if the custom component of the Vertex Element having the given name has the same type of the given template argument type of this function.
 
std::type_index perVertexCustomComponentType (const std::string &name) const
 Returns the std::type_index of the custom component of the Vertex Element having the given input name.
 
template<typename K >
requires vert::HasCustomComponents<T>
std::vector< std::string > perVertexCustomComponentNamesOfType () const
 Returns a vector containing all the names of the custom components associated to the Vertex Element having the same type of the given template argument type of this function.
 
template<typename K >
requires vert::HasCustomComponents<T>
void addPerVertexCustomComponent (const std::string &name)
 Adds a custom component of type K to the Vertex, having the given name.
 
void deletePerVertexCustomComponent (const std::string &name)
 Deletes the custom component of the given name from the Vertex Element.
 
template<typename K >
requires vert::HasCustomComponents<T>
CustomComponentVectorHandle< K > perVertexCustomComponentVectorHandle (const std::string &name)
 Returns a vector handle to the custom component having the type K and the given name.
 
template<typename K >
requires vert::HasCustomComponents<T>
ConstCustomComponentVectorHandle< K > perVertexCustomComponentVectorHandle (const std::string &name) const
 Returns a const vector handle to the custom component having type K and the given name.
 

Private Types

using VertexContainerType = VertexContainer< T >
 
using Base = ElementContainer< T >
 

Detailed Description

template<VertexConcept T>
class vcl::mesh::VertexContainer< T >

The Vertex Container class, will be used when the template argument given to the Mesh is a Vertex.

This class adds a container (vector) of vertices to the Mesh, making available the accessors members to the vertices, the vertex number, iterators... This class will also take care to add enablers/disablers of the eventual optional components of the vertex.

This container can be templated on a type that satisfies the VertexConcept concept.

Member Function Documentation

◆ addPerVertexCustomComponent()

template<VertexConcept T>
template<typename K >
requires vert::HasCustomComponents<T>
void vcl::mesh::VertexContainer< T >::addPerVertexCustomComponent ( const std::string &  name)
inline

Adds a custom component of type K to the Vertex, having the given name.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component added to the Vertex.
Parameters
[in]namethe name of the custom component added to the Vertex.

◆ addVertex() [1/2]

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::addVertex ( )
inline

Add a new vertex into the vertex container, returning the index of the added vertex.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Returns
the index of the new vertex.

◆ addVertex() [2/2]

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::addVertex ( const typename T::CoordType &  p)
inline

Add a new vertex with the given coordinate into the vertex container, returning the id of the added vertex.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Parameters
pcoordinate of the new vertex.
Returns
the id of the new vertex.

◆ addVertices() [1/3]

template<VertexConcept T>
template<typename... VC>
uint vcl::mesh::VertexContainer< T >::addVertices ( const typename T::CoordType &  p,
const VC &...  v 
)
inline

Add an arbitrary number of vertices with the given coordinates, returning the id of the first added vertex.

You can call this member function like:

CoordType p0, p1, p2, p3;
// init coords...
m.addVertices(p0, p1, p2, p3);
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43

The number of accepted Coordtype arguments is variable.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Parameters
pfirst vertex coordinate
vlist of other vertex coordinates
Returns
the id of the first added vertex.

◆ addVertices() [2/3]

template<VertexConcept T>
template<vcl::Range R>
requires RangeOf<R, typename T::CoordType>
uint vcl::mesh::VertexContainer< T >::addVertices ( R &&  range)
inline

Add an arbitrary number of vertices with the coordinates contained in the given range, returning the id of the first added vertex.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Parameters
rangethe range of coordinates of the vertices to add.
Returns
the id of the first added vertex.

◆ addVertices() [3/3]

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::addVertices ( uint  n)
inline

Add an arbitrary number of n vertices, returning the id of the first added vertex.

This means that, if you want to add 5 vertices and this member function returns 4, the added vertices will have id from 4 to id 8 included.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Parameters
nthe number of vertices to add to the mesh.
Returns
the id of the first added vertex.

◆ clearVertices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::clearVertices ( )
inline

Clears the Vertex container of the Mesh, deleting all the vertices.

The contained vertices are actually removed from the container, not only marked as deleted. Therefore, the container will have size 0 (vertexContainerSize() == 0) after the call of this function.

Note
This function does not cause a reallocation of the Vertex container.
Warning
Any pointer to vertices in the Mesh will be left unchanged, and therefore will point to invalid vertices. This means that, if you have a pointer to a vertex and you call this function, you will have a dangling pointer.

◆ deletedVertexNumber()

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::deletedVertexNumber ( ) const
inline

Returns the number of deleted vertices in the Vertex container, that is vertexContainerSize() - vertexNumber().

Returns
The number of deleted vertices in the container.

◆ deletePerVertexCustomComponent()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::deletePerVertexCustomComponent ( const std::string &  name)
inline

Deletes the custom component of the given name from the Vertex Element.

The function does nothing if the custom component does not exists.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Parameters
[in]namethe name of the custom component that will be removed from the Vertex.

◆ deleteVertex() [1/2]

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::deleteVertex ( const VertexType *  v)
inline

Marks as deleted the given vertex, before asserting that the vertex belongs to this container.

This member function does not perform any reallocation of the vertices: the deleted vertices will stay in the Vertex Container, but will be marked as deleted.

Deleted vertices are automatically jumped by the iterators provided by the Vertex Container.

Parameters
[in]vthe pointer of the vertex that will be marked as deleted.

◆ deleteVertex() [2/2]

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::deleteVertex ( uint  i)
inline

Marks as deleted the vertex with the given id.

This member function does not perform any reallocation of the vertices: the deleted vertices will stay in the Vertex Container, but will be marked as deleted.

Deleted vertices are automatically jumped by the iterators provided by the Vertex Container.

Parameters
[in]ithe id of the vertex that will be marked as deleted.

◆ disablePerVertexAdjacentEdges()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexAdjacentEdges ( )
inline

Disables the Optional Adjacent Edges of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentEdges Component.

◆ disablePerVertexAdjacentFaces()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexAdjacentFaces ( )
inline

Disables the Optional Adjacent Faces of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentFaces Component.

◆ disablePerVertexAdjacentVertices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexAdjacentVertices ( )
inline

Disables the Optional Adjacent Vertices of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentVertices Component.

◆ disablePerVertexColor()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexColor ( )
inline

Disables the Optional Color of the vertex.

Note
This function is available only if the Vertex Element has the OptionalColor Component.

◆ disablePerVertexMark()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexMark ( )
inline

Container::disableVertexMark disables the Optional Mark of the vertex.

Note
This function is available only if the Vertex Element has the OptionalMark Component.

◆ disablePerVertexNormal()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexNormal ( )
inline

Checks if the vertex Optional PrincipalCurvature is enabled.

Note
This function is available only if the Vertex Element has the OptionalPrincipalCurvature Component.

◆ disablePerVertexPrincipalCurvature()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexPrincipalCurvature ( )
inline

Disables the Optional PrincipalCurvature of the vertex.

Note
This function is available only if the Vertex Element has the OptionalPrincipalCurvature Component.

◆ disablePerVertexQuality()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexQuality ( )
inline

Disables the Optional Quality of the vertex.

Note
This function is available only if the Vertex Element has the OptionalQuality Component.

◆ disablePerVertexTexCoord()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::disablePerVertexTexCoord ( )
inline

Disables the Optional TexCoord of the vertex.

Note
This function is available only if the Vertex Element has the OptionalTexCoord Component.

◆ enablePerVertexAdjacentEdges()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexAdjacentEdges ( )
inline

Enables the Optional Adjacent Edges of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentEdges Component.

◆ enablePerVertexAdjacentFaces()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexAdjacentFaces ( )
inline

Enables the Optional Adjacent Faces of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentFaces Component.

◆ enablePerVertexAdjacentVertices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexAdjacentVertices ( )
inline

Enables the Optional Adjacent Vertices of the vertex.

Note
This function is available only if the Vertex Element has the OptionalAdjacentVertices Component.

◆ enablePerVertexColor()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexColor ( )
inline

Enables the Optional Color of the vertex.

Note
This function is available only if the Vertex Element has the OptionalColor Component.

◆ enablePerVertexMark()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexMark ( )
inline

Enables the Optional Mark of the vertex.

Note
This function is available only if the Vertex Element has the OptionalMark Component.

◆ enablePerVertexNormal()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexNormal ( )
inline

Enables the Optional Normal of the vertex.

Note
This function is available only if the Vertex Element has the OptionalNormal Component.

◆ enablePerVertexPrincipalCurvature()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexPrincipalCurvature ( )
inline

Enables the Optional PrincipalCurvature of the vertex.

Note
This function is available only if the Vertex Element has the OptionalPrincipalCurvature Component.

◆ enablePerVertexQuality()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexQuality ( )
inline

Enables the Optional Quality of the vertex.

Note
This function is available only if the Vertex Element has the OptionalQuality Component.

◆ enablePerVertexTexCoord()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::enablePerVertexTexCoord ( )
inline

Enables the Optional TexCoord of the vertex.

Note
This function is available only if the Vertex Element has the OptionalTexCoord Component.

◆ hasPerVertexCustomComponent()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::hasPerVertexCustomComponent ( const std::string &  name) const
inline

Checks if vertices have a custom component with the given name.

This function does not take into account the type of the custom component.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Returns
true if the Vertex Element has a custom component with the given name.

◆ isPerVertexAdjacentEdgesEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexAdjacentEdgesEnabled ( ) const
inline

Checks if the vertex Optional Adjacent Edges component is enabled.

Note
This function is available only if the Vertex Element has the OptionalAdjacentEdges Component.
Returns
true if the Optional Adjacent Edges is enabled, false otherwise.

◆ isPerVertexAdjacentFacesEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexAdjacentFacesEnabled ( ) const
inline

Checks if the vertex Optional Adjacent Faces component is enabled.

Note
This function is available only if the Vertex Element has the OptionalAdjacentFaces Component.
Returns
true if the Optional Adjacent Faces is enabled, false otherwise.

◆ isPerVertexAdjacentVerticesEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexAdjacentVerticesEnabled ( ) const
inline

Checks if the vertex Optional Adjacent Vertices component is enabled.

Note
This function is available **only if the Vertex Element has the OptionalAdjacentVertices Component.
Returns
true if the Optional Adjacent Vertices is enabled, false otherwise.

◆ isPerVertexColorEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexColorEnabled ( ) const
inline

Checks if the vertex Optional Color is enabled.

Note
This function is available only if the Vertex Element has the OptionalColor Component.
Returns
true if the Optional Color is enabled, false otherwise.

◆ isPerVertexCustomComponentOfType()

template<VertexConcept T>
template<typename K >
requires vert::HasCustomComponents<T>
bool vcl::mesh::VertexContainer< T >::isPerVertexCustomComponentOfType ( const std::string &  name) const
inline

Checks if the custom component of the Vertex Element having the given name has the same type of the given template argument type of this function.

For example, the following code checks if the component called cc is of type double:

if (m.isPerVertexCustomComponentOfType<double>("cc")) {
...
}
Note
This function is available only if the Vertex Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component to check.
Parameters
[in]namethe name of the custom component to check.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
true if the custom component is of the same type of the template argument.

◆ isPerVertexMarkEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexMarkEnabled ( ) const
inline

Checks if the vertex Optional Mark is enabled.

Note
This function is available only if the Vertex Element has the OptionalMark Component.
Returns
true if the Optional Mark is enabled, false otherwise.

◆ isPerVertexNormalEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexNormalEnabled ( ) const
inline

Checks if the vertex Optional Normal is enabled.

Note
This function is available only if the Vertex Element has the OptionalNormal Component.
Returns
true if the Optional Normal is enabled, false otherwise.

◆ isPerVertexPrincipalCurvatureEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexPrincipalCurvatureEnabled ( ) const
inline

Checks if the vertex Optional PrincipalCurvature is enabled.

Note
This function is available only if the Vertex Element has the OptionalPrincipalCurvature Component.
Returns
true if the Optional PrincipalCurvature is enabled, false otherwise.

◆ isPerVertexQualityEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexQualityEnabled ( ) const
inline

Checks if the vertex Optional Quality is enabled.

Note
This function is available only if the Vertex Element has the OptionalQuality Component.
Returns
true if the Optional Quality is enabled, false otherwise.

◆ isPerVertexTexCoordEnabled()

template<VertexConcept T>
bool vcl::mesh::VertexContainer< T >::isPerVertexTexCoordEnabled ( ) const
inline

Checks if the vertex Optional TexCoord is enabled.

Note
This function is available only if the Vertex Element has the OptionalTexCoord Component.
Returns
true if the Optional TexCoord is enabled, false otherwise.

◆ perVertexCustomComponentNames()

template<VertexConcept T>
std::vector< std::string > vcl::mesh::VertexContainer< T >::perVertexCustomComponentNames ( ) const
inline

Returns a vector containing all the names of the custom components of any type associated to the Vertex Element.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Returns
A vector of strings representing all the names of the custom components.

◆ perVertexCustomComponentNamesOfType()

template<VertexConcept T>
template<typename K >
requires vert::HasCustomComponents<T>
std::vector< std::string > vcl::mesh::VertexContainer< T >::perVertexCustomComponentNamesOfType ( ) const
inline

Returns a vector containing all the names of the custom components associated to the Vertex Element having the same type of the given template argument type of this function.

For example, the following code gets a vector containing all the custom components of type double:

std::vector<std::string> cdouble =
m.perVertexCustomComponentNamesOfType<double>();
Note
This function is available only if the Vertex Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component names.
Returns
A vector of strings representing the names of the custom components of a given type.

◆ perVertexCustomComponentType()

template<VertexConcept T>
std::type_index vcl::mesh::VertexContainer< T >::perVertexCustomComponentType ( const std::string &  name) const
inline

Returns the std::type_index of the custom component of the Vertex Element having the given input name.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Parameters
[in]namethe name of the custom component to get the std::type_index from.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
The std::type_index of the custom component having the given input name.

◆ perVertexCustomComponentVectorHandle() [1/2]

template<VertexConcept T>
template<typename K >
requires vert::HasCustomComponents<T>
CustomComponentVectorHandle< K > vcl::mesh::VertexContainer< T >::perVertexCustomComponentVectorHandle ( const std::string &  name)
inline

Returns a vector handle to the custom component having the type K and the given name.

The handle can be used like a normal std::vector, but does not have access to the modifiers member functions (resize, push_back...). The handle contains references to the custom component, therefore you can modify the custom component by modifying the element of the handle vector normally. Since the handle stores references, there are no copies performed when calling this function.

For example, assuming that the mesh has a vertex custom component named "cc" of type int:

auto handle = m.perVertexCustomComponentVectorHandle<int>("cc");
for (Vertex& v : m.vertices() {
handle[m.index(v)] = 5; // v.customComponent<int>("cc") == 5
assert(v.customComponent<int>("cc") == 5);
}
auto vertices(bool jumpDeleted=true)
Returns a small utility object that allows to iterate over the vertices of the containers,...
Definition vertex_container.h:462

Using handles allows to access more efficiently to custom components rather accessing from an element object. However, note that references are binded to the container of the mesh.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Since the handle contains references, any operation that changes the size of the container could be destructive and invalidate the references contained in the handle.
Template Parameters
Kthe type of the custom component on which return the handle.
Parameters
[in]namename of the custom component on which return the handle.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
a vector handle that allows to access to the custom component.

◆ perVertexCustomComponentVectorHandle() [2/2]

template<VertexConcept T>
template<typename K >
requires vert::HasCustomComponents<T>
ConstCustomComponentVectorHandle< K > vcl::mesh::VertexContainer< T >::perVertexCustomComponentVectorHandle ( const std::string &  name) const
inline

Returns a const vector handle to the custom component having type K and the given name.

The handle can be used like a normal std::vector, but does not have access to the modifiers member functions (resize, push_back...). The handle contains const references to the custom component, therefore you can access to the custom component by accessing the element of the handle vector normally. Since the handle stores references, there are no copies performed when calling this function.

For example, assuming that the mesh has a vertex custom component named "cc" of type int:

// access to the const handle by making const the template parameter:
auto handle = m.perVertexCustomComponentVectorHandle<const int>("cc");
int sum = 0;
for (const Vertex& v : m.vertices() {
sum += handle[m.index(v)];
// handle[m.index(v)] = 5; // not allowed, because the handle is const
}

Using handles allows to access more efficiently to custom components rather accessing from an element object. However, note that references are binded to the container of the mesh.

Note
This function is available only if the Vertex Element has the CustomComponents Component.
Since the handle contains references, any operation that changes the size of the container could be destructive and invalidate the references contained in the handle.
Template Parameters
Kthe type of the custom component on which return the handle.
Parameters
[in]namename of the custom component on which return the handle.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
a const vector handle that allows to access to the custom component.

◆ reserveVertices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::reserveVertices ( uint  n)
inline

Reserve a number of vertices in the container of Vertices. This is useful when you know (or you have an idea) of how much vertices are going to add into a newly or existing mesh. Calling this function before any add_vertex() call will avoid unuseful reallocations of the container, saving execution time.

The filosofy of this function is similar to the one of the reserve() function of the std::vector class.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Parameters
nthe new capacity of the vertex container.

◆ resizeVertices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::resizeVertices ( uint  n)
inline

Resizes the Vertex container to contain n vertices.

If the new size is greater than the old one, new vertices are added to the container, and a reallocation may happen. If the new size is smaller than the old one, the container will keep its first non-deleted n vertices, and the remaining vertices are marked as deleted.

If the call of this function will cause a reallocation of the Vertex container, the function will automatically take care of updating all the Vertex pointers contained in the Mesh.

Warning
The given size n is relative to the number of non-deleted vertices, not to the size of the vertex container. For example, if you have a mesh with 10 vertices and vertexContainerSize() == 20, calling resizeVertices(5) will not cause a reallocation of the container, but will mark as deleted the least 5 non-deleted vertices of the container. In the same scenario, calling resizeVertices(15) will result in a vertex container having 15 vertices and vertexContainerSize() == 25. The latest 5 vertices will be the newly added.
Any pointer to deleted vertices in the Mesh will be left unchanged, and therefore will point to invalid vertices. This means that if you call this member function with a lower number of vertices, you'll need to manually manage the pointers to the deleted vertices.
Parameters
[in]nthe new size of the Vertex container.

◆ updateVertexIndices()

template<VertexConcept T>
void vcl::mesh::VertexContainer< T >::updateVertexIndices ( const std::vector< uint > &  newIndices)
inline

Updates all the indices and pointers of the vertices of this container that are stored in any container of the mesh, according to the mapping stored in the newIndices vector, that tells for each old vertex index, the new vertex index.

This function is useful when some vertices, and you want to update the indices/pointers stored in all the containers of the mesh accordingly.

E.g. Supposing you deleted a set of vertices, you can give to this function the vector telling, for each of the old vertex indices, the new vertex index (or UINT_NULL if you want to leave it unreferenced). This function will update all the pointers stored in the mesh containers accordingly (if they store adjacencies to the vertices).

Note
This function does not change the position of the vertices in this container. It just updates the indices/pointers of the vertices stored in this or other containers.
Parameters
[in]newIndicesa vector that tells, for each old vertex index, the new vertex index. If the old vertex must be left as unreferenced (setting nullptr to the pointers), the value of the vector must be UINT_NULL.

◆ vertex() [1/2]

template<VertexConcept T>
VertexType & vcl::mesh::VertexContainer< T >::vertex ( uint  i)
inline

Returns a reference of the vertex at the i-th position in the Vertex Container of the Mesh, which will be the vertex having index = i.

This function does not perform any sanity check: if i is less than vertexContainerSize(), this function will return a valid Vertex reference (note that the Vertex may have been flagged as deleted).

Parameters
[in]ithe index of the vertex that will be returned.

◆ vertex() [2/2]

template<VertexConcept T>
const VertexType & vcl::mesh::VertexContainer< T >::vertex ( uint  i) const
inline

Returns a const reference of the vertex at the i-th position in the Vertex Container of the Mesh, which will be the vertex having index = i.

This function does not perform any sanity check: if i is less than vertexContainerSize(), this function will return a valid Vertex reference (note that the Vertex may have been flagged as deleted).

Parameters
[in]ithe index of the vertex that will be returned.

◆ vertexBegin() [1/2]

template<VertexConcept T>
VertexIterator vcl::mesh::VertexContainer< T >::vertexBegin ( bool  jumpDeleted = true)
inline

Returns an iterator to the beginning of the container.

The iterator is automatically initialized to jump deleted vertices of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeleted(def: true): boolean that tells if the iterator should jump deleted vertices.
Returns
An iterator the the first vertex of the container.

◆ vertexBegin() [2/2]

template<VertexConcept T>
ConstVertexIterator vcl::mesh::VertexContainer< T >::vertexBegin ( bool  jumpDeleted = true) const
inline

Returns a const iterator to the beginning of the container.

The iterator is automatically initialized to jump deleted vertices of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeleted(def: true): boolean that tells if the iterator should jump deleted vertices.
Returns
A const iterator the the first vertex of the container.

◆ vertexCompactIndices()

template<VertexConcept T>
std::vector< uint > vcl::mesh::VertexContainer< T >::vertexCompactIndices ( ) const
inline

Returns a vector that tells, for each actual vertex index, the new index that the vertex would have in a compacted container. For each deleted vertex index, the value of the vector will be UINT_NULL.

This is useful if you need to know the indices of the vertices that they would have in a compact container, without considering the deleted ones.

Returns
A vector containing, for each vertex index, its index if the container would be compact.

◆ vertexContainerSize()

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::vertexContainerSize ( ) const
inline

Returns the number of vertices (also deleted) contained in the Vertex container of the Mesh.

If vertexNumber() != vertexContainerSize(), it means that there are some vertices that are flagged as deleted.

Returns
The number of all the vertices contained in the Mesh.

◆ vertexEnd() [1/2]

template<VertexConcept T>
VertexIterator vcl::mesh::VertexContainer< T >::vertexEnd ( )
inline

Returns an iterator to the end of the container.

Returns
An iterator to the end of the container.

◆ vertexEnd() [2/2]

template<VertexConcept T>
ConstVertexIterator vcl::mesh::VertexContainer< T >::vertexEnd ( ) const
inline

Returns a const iterator to the end of the container.

Returns
A const iterator to the end of the container.

◆ vertexIndexIfCompact()

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::vertexIndexIfCompact ( uint  i) const
inline

This is an utility member function that returns the index of an element if the container would be compact, that is the number of non-deleted elements before the vertex with the given index.

Complexity: O(n), with n the number of vertices in the container.

This function does not perform any sanity check on the given index.

Parameters
[in]ithe index of a vertex of the container.
Returns
The index that the vertex with index i would have if this container would be compact.

◆ vertexNumber()

template<VertexConcept T>
uint vcl::mesh::VertexContainer< T >::vertexNumber ( ) const
inline

Returns the number of non-deleted vertices contained in the Vertex container of the Mesh.

If vertexNumber() != vertexContainerSize(), it means that there are some vertices that are flagged as deleted.

Returns
The number of non-deleted vertices of the Mesh.

◆ vertices() [1/2]

template<VertexConcept T>
auto vcl::mesh::VertexContainer< T >::vertices ( bool  jumpDeleted = true)
inline

Returns a small utility object that allows to iterate over the vertices of the containers, providing two member functions begin() and end().

This member function is very useful when you want to iterate over the vertices using the C++ foreach syntax:

for (Vertex& v : m.vertices()){
// do something with this vertex
}

The iterator used to iterate over vertices is automatically initialized to jump deleted vertices of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeleted(def: true): boolean that tells if the iterator should jump deleted vertices.
Returns
An object having begin() and end() function, allowing to iterate over the container.

◆ vertices() [2/2]

template<VertexConcept T>
auto vcl::mesh::VertexContainer< T >::vertices ( bool  jumpDeleted = true) const
inline

Returns a small utility object that allows to iterate over the vertices of the containers, providing two member functions begin() and end().

This member function is very useful when you want to iterate over the vertices using the C++ foreach syntax:

for (const Vertex& v : m.vertices()){
// do something with this vertex
}

The iterator used to iterate over vertices is automatically initialized to jump deleted vertices of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeleted(def: true): boolean that tells if the iterator should jump deleted vertices.
Returns
An object having begin() and end() function, allowing to iterate over the container.

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