23#ifndef VCL_MESH_CONTAINERS_VERTEX_CONTAINER_H
24#define VCL_MESH_CONTAINERS_VERTEX_CONTAINER_H
26#include "base/element_container.h"
28#include <vclib/mesh/elements/vertex.h>
29#include <vclib/mesh/elements/vertex_components.h>
50template<VertexConcept T>
53 template<VertexConcept U>
62 using VertexIterator = Base::ElementIterator;
63 using ConstVertexIterator = Base::ConstElementIterator;
81 const VertexType&
vertex(
uint i)
const {
return Base::element(
i); }
193 template<
typename...
VC>
217 template<vcl::Range R>
222 for (
const auto& v :
range) {
348 return Base::elementIndexIfCompact(
i);
364 return Base::elementCompactIndices();
416 VertexIterator
vertexEnd() {
return Base::elementEnd(); }
438 ConstVertexIterator
vertexEnd()
const {
return Base::elementEnd(); }
494 return Base::elements(begin, end);
551 return Base::elements(begin, end);
560 Base::enableAllOptionalComponents();
569 Base::disableAllOptionalComponents();
583 requires vert::HasOptionalAdjacentEdges<T>
586 typename T::AdjacentEdges>();
596 requires vert::HasOptionalAdjacentEdges<T>
608 requires vert::HasOptionalAdjacentEdges<T>
624 requires vert::HasOptionalAdjacentFaces<T>
627 typename T::AdjacentFaces>();
637 requires vert::HasOptionalAdjacentFaces<T>
649 requires vert::HasOptionalAdjacentFaces<T>
667 requires vert::HasOptionalAdjacentVertices<T>
670 typename T::AdjacentVertices>();
680 requires vert::HasOptionalAdjacentVertices<T>
692 requires vert::HasOptionalAdjacentVertices<T>
821 requires vert::HasOptionalPrincipalCurvature<T>
824 typename T::PrincipalCurvature>();
834 requires vert::HasOptionalPrincipalCurvature<T>
837 typename T::PrincipalCurvature>();
847 requires vert::HasOptionalPrincipalCurvature<T>
850 typename T::PrincipalCurvature>();
901 requires vert::HasOptionalTexCoord<T>
904 typename T::TexCoord>();
946 return Base::hasElemCustomComponent(name);
962 return Base::elemCustomComponentNames();
1013 return Base::elemComponentType(name);
1035 template<
typename K>
1052 template<
typename K>
1074 Base::deleteElemCustomComponent(name);
1118 template<
typename K>
1169 template<
typename K>
1186 template<
typename K>
1203 template<
typename K>
1227 std::remove_cvref_t<T>,
1228 VertexContainer<typename RemoveRef<T>::VertexType>>;
1266template<
typename... Args>
A class representing a box in N-dimensional space.
Definition box.h:46
The Vertex Container class, will be used when the template argument given to the Mesh is a Vertex.
Definition vertex_container.h:52
void deserializePerVertexCustomComponentsOfType(std::istream &is)
Deserializes in the given input stream all the custom components of the Vertex Element of type K.
Definition vertex_container.h:1204
void disablePerVertexPrincipalCurvature()
Disables the Optional PrincipalCurvature of the vertex.
Definition vertex_container.h:846
void updateVertexIndices(const std::vector< uint > &newIndices)
Updates all the indices and pointers of the vertices of this container that are stored in any contain...
Definition vertex_container.h:391
void disablePerVertexTexCoord()
Disables the Optional TexCoord of the vertex.
Definition vertex_container.h:924
auto vertices(bool jumpDeleted=true)
Returns a small utility object that allows to iterate over the vertices of the containers,...
Definition vertex_container.h:463
bool isPerVertexColorEnabled() const
Checks if the vertex Optional Color is enabled.
Definition vertex_container.h:707
void enablePerVertexAdjacentEdges()
Enables the Optional Adjacent Edges of the vertex.
Definition vertex_container.h:595
void deleteVertex(uint i)
Marks as deleted the vertex with the given id.
Definition vertex_container.h:316
VertexType & vertex(uint i)
Returns a reference of the vertex at the i-th position in the Vertex Container of the Mesh,...
Definition vertex_container.h:93
void clearVertices()
Clears the Vertex container of the Mesh, deleting all the vertices.
Definition vertex_container.h:244
bool isPerVertexQualityEnabled() const
Checks if the vertex Optional Quality is enabled.
Definition vertex_container.h:863
auto vertices(bool jumpDeleted=true) const
Returns a small utility object that allows to iterate over the vertices of the containers,...
Definition vertex_container.h:520
void disablePerVertexQuality()
Disables the Optional Quality of the vertex.
Definition vertex_container.h:885
ConstVertexIterator vertexEnd() const
Returns a const iterator to the end of the container.
Definition vertex_container.h:438
std::vector< std::string > perVertexCustomComponentNames() const
Returns a vector containing all the names of the custom components of any type associated to the Vert...
Definition vertex_container.h:959
ConstCustomComponentVectorHandle< K > perVertexCustomComponentVectorHandle(const std::string &name) const
Returns a const vector handle to the custom component having type K and the given name.
Definition vertex_container.h:1170
void disablePerVertexAdjacentFaces()
Disables the Optional Adjacent Faces of the vertex.
Definition vertex_container.h:648
void disablePerVertexNormal()
Checks if the vertex Optional PrincipalCurvature is enabled.
Definition vertex_container.h:804
void resizeVertices(uint n)
Resizes the Vertex container to contain n vertices.
Definition vertex_container.h:274
void compactVertices()
Compacts the Vertex Container, removing all the vertices marked as deleted. Vertices indices will cha...
Definition vertex_container.h:302
bool hasPerVertexCustomComponent(const std::string &name) const
Checks if vertices have a custom component with the given name.
Definition vertex_container.h:943
auto vertices(uint begin, uint end=UINT_NULL) const
Returns a view object that allows to iterate over the Vertices of the container in the given range:
Definition vertex_container.h:549
auto vertices(uint begin, uint end=UINT_NULL)
Returns a view object that allows to iterate over the Vertices of the container in the given range:
Definition vertex_container.h:492
void deletePerVertexCustomComponent(const std::string &name)
Deletes the custom component of the given name from the Vertex Element.
Definition vertex_container.h:1071
void enablePerVertexColor()
Enables the Optional Color of the vertex.
Definition vertex_container.h:718
uint vertexNumber() const
Returns the number of non-deleted vertices contained in the Vertex container of the Mesh.
Definition vertex_container.h:104
ConstVertexIterator vertexBegin(bool jumpDeleted=true) const
Returns a const iterator to the beginning of the container.
Definition vertex_container.h:429
void addPerVertexCustomComponent(const std::string &name)
Adds a custom component of type K to the Vertex, having the given name.
Definition vertex_container.h:1053
uint addVertex(const typename T::PositionType &p)
Add a new vertex with the given position into the vertex container, returning the id of the added ver...
Definition vertex_container.h:148
uint vertexIndexIfCompact(uint i) const
This is an utility member function that returns the index of an element if the container would be com...
Definition vertex_container.h:346
void disableAllPerVertexOptionalComponents()
Disables all the optional components associated to the Vertex type contained in the VertexContainer.
Definition vertex_container.h:567
CustomComponentVectorHandle< K > perVertexCustomComponentVectorHandle(const std::string &name)
Returns a vector handle to the custom component having the type K and the given name.
Definition vertex_container.h:1119
uint addVertices(uint n)
Add an arbitrary number of n vertices, returning the id of the first added vertex.
Definition vertex_container.h:169
bool isPerVertexAdjacentVerticesEnabled() const
Checks if the vertex Optional Adjacent Vertices component is enabled.
Definition vertex_container.h:666
void enablePerVertexPrincipalCurvature()
Enables the Optional PrincipalCurvature of the vertex.
Definition vertex_container.h:833
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...
Definition vertex_container.h:1010
uint addVertex()
Add a new vertex into the vertex container, returning the index of the added vertex.
Definition vertex_container.h:135
bool isPerVertexPrincipalCurvatureEnabled() const
Checks if the vertex Optional PrincipalCurvature is enabled.
Definition vertex_container.h:820
uint addVertices(const typename T::PositionType &p, const VC &... v)
Add an arbitrary number of vertices with the given positions, returning the id of the first added ver...
Definition vertex_container.h:194
void enablePerVertexTexCoord()
Enables the Optional TexCoord of the vertex.
Definition vertex_container.h:913
void enablePerVertexAdjacentVertices()
Enables the Optional Adjacent Vertices of the vertex.
Definition vertex_container.h:679
bool isPerVertexAdjacentEdgesEnabled() const
Checks if the vertex Optional Adjacent Edges component is enabled.
Definition vertex_container.h:582
void serializePerVertexCustomComponentsOfType(std::ostream &os) const
Serializes in the given output stream all the custom components of the Vertex Element of type K.
Definition vertex_container.h:1187
std::vector< std::string > perVertexCustomComponentNamesOfType() const
Returns a vector containing all the names of the custom components associated to the Vertex Element h...
Definition vertex_container.h:1036
void enablePerVertexNormal()
Enables the Optional Normal of the vertex.
Definition vertex_container.h:793
uint vertexContainerSize() const
Returns the number of vertices (also deleted) contained in the Vertex container of the Mesh.
Definition vertex_container.h:115
void disablePerVertexAdjacentEdges()
Disables the Optional Adjacent Edges of the vertex.
Definition vertex_container.h:607
void enablePerVertexMark()
Enables the Optional Mark of the vertex.
Definition vertex_container.h:755
VertexIterator vertexBegin(bool jumpDeleted=true)
Returns an iterator to the beginning of the container.
Definition vertex_container.h:407
bool isPerVertexAdjacentFacesEnabled() const
Checks if the vertex Optional Adjacent Faces component is enabled.
Definition vertex_container.h:623
void enablePerVertexAdjacentFaces()
Enables the Optional Adjacent Faces of the vertex.
Definition vertex_container.h:636
void disablePerVertexAdjacentVertices()
Disables the Optional Adjacent Vertices of the vertex.
Definition vertex_container.h:691
void disablePerVertexMark()
Container::disableVertexMark disables the Optional Mark of the vertex.
Definition vertex_container.h:767
uint addVertices(R &&range)
Add an arbitrary number of vertices with the positions contained in the given range,...
Definition vertex_container.h:218
void disablePerVertexColor()
Disables the Optional Color of the vertex.
Definition vertex_container.h:729
void reserveVertices(uint n)
Reserve a number of vertices in the container of Vertices. This is useful when you know (or you have ...
Definition vertex_container.h:294
VertexContainer()=default
Empty constructor that creates an empty container of Vertices.
bool isPerVertexTexCoordEnabled() const
Checks if the vertex Optional TexCoord is enabled.
Definition vertex_container.h:900
void enableAllPerVertexOptionalComponents()
Enables all the optional components associated to the Vertex type contained in the VertexContainer.
Definition vertex_container.h:558
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 g...
Definition vertex_container.h:989
VertexIterator vertexEnd()
Returns an iterator to the end of the container.
Definition vertex_container.h:416
bool isPerVertexNormalEnabled() const
Checks if the vertex Optional Normal is enabled.
Definition vertex_container.h:782
bool isPerVertexMarkEnabled() const
Checks if the vertex Optional Mark is enabled.
Definition vertex_container.h:744
uint deletedVertexNumber() const
Returns the number of deleted vertices in the Vertex container, that is vertexContainerSize() - verte...
Definition vertex_container.h:123
void enablePerVertexQuality()
Enables the Optional Quality of the vertex.
Definition vertex_container.h:874
std::vector< uint > vertexCompactIndices() const
Returns a vector that tells, for each actual vertex index, the new index that the vertex would have i...
Definition vertex_container.h:362
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,...
Definition vertex_container.h:81
void deleteVertex(const VertexType *v)
Marks as deleted the given vertex, before asserting that the vertex belongs to this container.
Definition vertex_container.h:331
HasVertices concepts is satisfied when at least one of its types is (or inherits from) a vcl::mesh::V...
Definition vertex_container.h:1267
Utility concept that is evaluated true the Range R has a value_type that is exactly T.
Definition range.h:66
Definition mesh_components.h:52
A concept that checks whether a class has (inherits from) a VertexContainer class.
Definition vertex_container.h:1226
Definition vertex_components.h:85
constexpr uint UINT_NULL
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented ...
Definition base.h:48