Visual Computing Library
|
The AdjacentVertices class is a container of Vertex indices or pointers. It is a component that makes sense to use mostly on Vertex Elements. For Faces and Edges, see the VertexPointers component (which is similar, but has different member function names). More...
#include <vclib/mesh/components/adjacent_vertices.h>
Public Types | |
using | AdjacentVertexType = Vertex |
Expose the type of the Adjacent Vertex. | |
using | AdjacentVertexIterator = Base::Iterator |
using | ConstAdjacentVertexIterator = Base::ConstIterator |
using | ConstAdjacentVertexIndexIterator = Base::ConstIndexIterator |
Public Member Functions | |
AdjacentVertices ()=default | |
Empty constructor. | |
uint | adjVerticesNumber () const |
Returns the number of adjacent vertices of the element. | |
Vertex * | adjVertex (uint i) |
Returns the pointer to the i-th adjacent vertex of an element. | |
const Vertex * | adjVertex (uint i) const |
Returns a const pointer to the i-th adjacent vertex of the element. | |
uint | adjVertexIndex (uint i) const |
Returns the index in the vertex container of the i-th adjacent vertex of the element. | |
Vertex * | adjVertexMod (int i) |
Returns the pointer to the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to get the "next adjacent
vertex after position k", without check if it is less than the number of adj vertices. Works also for negative numbers: | |
const Vertex * | adjVertexMod (int i) const |
Same of adjVertexMod, but returns a const Pointer to the adjacent vertex. | |
uint | adjVertexIndexMod (int i) const |
Returns the index in the vertex container of the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to get the "index of the adjacent vertex next to position k", without check if it is less than the number of adjacent vertices. Works also for negative numbers: | |
void | setAdjVertex (uint i, Vertex *v) |
Sets the i-th adjacent vertex of the element. | |
void | setAdjVertex (uint i, uint vi) |
Sets the i-th adjacent vertex of the element. | |
void | setAdjVertex (ConstAdjacentVertexIterator it, Vertex *v) |
Sets the adjacent vertex pointed by the iterator. | |
void | setAdjVertex (ConstAdjacentVertexIterator it, uint vi) |
Sets the adjacent vertex pointed by the iterator. | |
void | setAdjVertex (ConstAdjacentVertexIndexIterator it, Vertex *v) |
Sets the adjacent vertex pointed by the iterator. | |
void | setAdjVertex (ConstAdjacentVertexIndexIterator it, uint vi) |
Sets the adjacent vertex pointed by the iterator. | |
void | setAdjVertexMod (int i, Vertex *v) |
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to set the "next adjacent vertex after position
k", without check if it is less than the number of adjacent vertices. Works also for negative numbers: | |
void | setAdjVertexMod (int i, uint vi) |
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to set the "next adjacent vertex after position
k", without check if it is less than the number of adjacent vertices. Works also for negative numbers: | |
template<Range Rng> requires InputRange<Rng, Vertex*> | |
void | setAdjVertices (Rng &&r) |
Sets all the adjacent vertices of this element. | |
template<Range Rng> requires InputRange<Rng, uint> | |
void | setAdjVertices (Rng &&r) |
Sets all the adjacent vertices of this element. | |
bool | containsAdjVertex (const Vertex *v) const |
Returns true if the container of adjacent vertices contains the given vertex, false otherwise. | |
bool | containsAdjVertex (uint vi) const |
Returns true if the container of adjacent vertices contains the given vertex, false otherwise. | |
uint | indexOfAdjVertex (const Vertex *v) const |
Returns the index of the given adjacent vertex in the container of the element. If the given adjacent vertex is not in the container, returns UINT_NULL. | |
uint | indexOfAdjVertex (uint vi) const |
Returns the index of the adjacent vertex with the given index in the container of the element. If the given adjacent vertex is not in the container, returns UINT_NULL. | |
void | resizeAdjVertices (uint n) |
Resize the container of the adjacent vertices to the given size. | |
void | pushAdjVertex (Vertex *v) |
Pushes in the back of the container the given adjacent vertex. | |
void | pushAdjVertex (uint vi) |
Pushes in the back of the container the given adjacent vertex.. | |
void | insertAdjVertex (uint i, Vertex *v) |
Inserts the given adjacent vertex in the container at the given position. | |
void | insertAdjVertex (uint i, uint vi) |
Inserts the given adjacent vertex in the container at the given position. | |
void | eraseAdjVertex (uint i) |
Removes the adjacent vertex at the given position from the container. | |
void | clearAdjVertices () |
Clears the container of adjacent vertices, making it empty. | |
AdjacentVertexIterator | adjVertexBegin () |
Returns an iterator to the first adjacent vertex in the container of this component. | |
AdjacentVertexIterator | adjVertexEnd () |
Returns an iterator to the end of the container of this component. | |
ConstAdjacentVertexIterator | adjVertexBegin () const |
Returns a const iterator to the first adjacent vertex in the container of this component. | |
ConstAdjacentVertexIterator | adjVertexEnd () const |
Returns a const iterator to the end of the container of this component. | |
ConstAdjacentVertexIndexIterator | adjVertexIndexBegin () const |
Returns an iterator to the first adjacent vertex index in the container of this component. | |
ConstAdjacentVertexIndexIterator | adjVertexIndexEnd () const |
Returns an iterator to the end of the container of this component. | |
View< AdjacentVertexIterator > | adjVertices () |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent vertices of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
View< ConstAdjacentVertexIterator > | adjVertices () const |
Returns a lightweight const view object that stores the begin and end iterators of the container of adjacent vertices of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
View< ConstAdjacentVertexIndexIterator > | adjVertexIndices () const |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent vertex indices of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops: | |
void | __adjacentVertices () const |
Protected Member Functions | |
template<typename Element > | |
void | importFrom (const Element &e, bool importRefs=true) |
void | serialize (std::ostream &os) const |
void | deserialize (std::istream &is) |
![]() | |
uint | size () const |
Elem * | element (uint i) |
const Elem * | element (uint i) const |
uint | elementIndex (uint i) const |
Elem * | elementMod (int i) |
const Elem * | elementMod (int i) const |
uint | elementIndexMod (int i) const |
void | setElement (uint i, Elem *e) |
void | setElement (uint i, uint ei) |
void | setElement (Base::ConstIterator it, Elem *v) |
void | setElement (Base::ConstIterator it, uint vi) |
void | setElement (Base::ConstIndexIterator it, Elem *v) |
void | setElement (Base::ConstIndexIterator it, uint vi) |
void | setElementMod (int i, Elem *e) |
void | setElementMod (int i, uint ei) |
template<Range Rng> requires InputRange<Rng, Elem*> | |
void | setElements (Rng &&r) |
template<Range Rng> requires InputRange<Rng, uint> | |
void | setElements (Rng &&r) |
bool | containsElement (const Elem *e) const |
bool | containsElement (uint ei) const |
uint | indexOfElement (const Elem *e) const |
uint | indexOfElement (uint ei) const |
Base::Iterator | elementBegin () |
Base::Iterator | elementEnd () |
Base::ConstIterator | elementBegin () const |
Base::ConstIterator | elementEnd () const |
Base::ConstIndexIterator | elementIndexBegin () const |
Base::ConstIndexIterator | elementIndexEnd () const |
View< typename Base::Iterator > | elements () |
View< typename Base::ConstIterator > | elements () const |
View< typename Base::ConstIndexIterator > | elementIndices () const |
void | resize (uint n) |
void | pushBack (Elem *e=nullptr) |
void | pushBack (uint ei) |
void | insert (uint i, Elem *e=nullptr) |
void | insert (uint i, uint ei) |
void | erase (uint i) |
void | clear () |
uint | indexFromPointer (const Elem *v) const |
Elem * | elemFromParent (uint vi) |
const Elem * | elemFromParent (uint vi) const |
Private Types | |
using | Base = ReferenceContainerComponent< STORE_INDICES, AdjacentVertices< STORE_INDICES, Vertex, ParentElemType, VERT, OPT >, CompId::ADJACENT_VERTICES, Vertex, -1, ParentElemType, VERT, OPT, false > |
Private Member Functions | |
template<typename Element > | |
void | importIndicesFrom (const Element &e) |
Additional Inherited Members | |
![]() | |
using | Base = std::conditional_t< STORE_INDICES, IndexContainerComponent< DerivedComponent, COMP_ID, Elem, N, ParentElemType, VERT, OPT, TTVN >, PointerContainerComponent< DerivedComponent, COMP_ID, Elem, N, ParentElemType, VERT, OPT, TTVN > > |
The AdjacentVertices class is a container of Vertex indices or pointers. It is a component that makes sense to use mostly on Vertex Elements. For Faces and Edges, see the VertexPointers component (which is similar, but has different member function names).
It is a random access container having dynamic size.
The member functions of this class will be available in the instance of any Element that will contain this component.
For example, if you have a Vertex Element v
that has the AdjacentVertices component, you'll be able to access to this component member functions from v
:
N
, because the container of adjacent vertices is always dynamic (there are no contexts in which it would make sense to have a fixed size container of adjacent vertices);TTVN
, because this argument is used on components that could be part of face elements, and this component does not apply to faces.STORE_INDICES | If true, the component will store indices, otherwise pointers to Face. |
Vertex | The type of the adjacent Vertex element. |
ParentElemType | This type is used to get access to the Element that has the component (and, in case, to the Mesh that has the Element). If the component doesn't need to access the Element, this type can be void. Note: if the component is vertical (or optional), this type cannot be void. |
VERT | If true, the component will be stored vertically. This argument is considered only if the ElementType is not void. |
OPT | If true, the component will be optional. This argument is considered only if the component is stored vertically. |
|
default |
Empty constructor.
Initializes an empty container of Adjacent Vertices.
|
inline |
Returns the pointer to the i-th adjacent vertex of an element.
[in] | i | the position of the required adjacent vertex in this container. |
|
inline |
Returns a const pointer to the i-th adjacent vertex of the element.
[in] | i | the position of the required adjacent vertex in this container; the value must be between 0 and the number of adj vertices. |
|
inline |
Returns an iterator to the first adjacent vertex in the container of this component.
|
inline |
Returns a const iterator to the first adjacent vertex in the container of this component.
|
inline |
Returns an iterator to the end of the container of this component.
|
inline |
Returns a const iterator to the end of the container of this component.
|
inline |
Returns the index in the vertex container of the i-th adjacent vertex of the element.
[in] | i | the position of the required vertex in this container. |
|
inline |
Returns an iterator to the first adjacent vertex index in the container of this component.
|
inline |
Returns an iterator to the end of the container of this component.
|
inline |
Returns the index in the vertex container of the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to get the "index of the adjacent vertex next to position k", without check if it is less than the number of adjacent vertices. Works also for negative numbers:
[in] | i | the position of the required adjacent vertex in this container, w.r.t. the position 0; value is modularized on adjVerticesNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent vertex indices of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns the pointer to the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to get the "next adjacent vertex after position k", without check if it is less than the number of adj vertices. Works also for negative numbers:
[in] | i | the position of the required adjacent vertex in this container, w.r.t. the position 0; value is modularized on adjVertexNumber(). |
|
inline |
Same of adjVertexMod, but returns a const Pointer to the adjacent vertex.
[in] | i | the position of the required adjacent vertex in this container, w.r.t. the position 0; value is modularized on adjVertexNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of adjacent vertices of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns a lightweight const view object that stores the begin and end iterators of the container of adjacent vertices of the element. The view object exposes the iterators trough the begin()
and end()
member functions, and therefore the returned object can be used in range-based for loops:
|
inline |
Returns the number of adjacent vertices of the element.
|
inline |
Clears the container of adjacent vertices, making it empty.
|
inline |
Returns true
if the container of adjacent vertices contains the given vertex, false
otherwise.
[in] | v | the pointer to the vertex to search. |
true
if the container of adjacent vertices contains the given vertex, false
otherwise.
|
inline |
Returns true
if the container of adjacent vertices contains the given vertex, false
otherwise.
[in] | vi | the index of the vertex to search. |
true
if the container of adjacent vertices contains the given vertex, false
otherwise.
|
inline |
Removes the adjacent vertex at the given position from the container.
[in] | i | The position of the adjacent vertex to remove from this container. |
|
inline |
Returns the index of the given adjacent vertex in the container of the element. If the given adjacent vertex is not in the container, returns UINT_NULL.
[in] | v | the pointer to the adjacent vertex to search. |
|
inline |
Returns the index of the adjacent vertex with the given index in the container of the element. If the given adjacent vertex is not in the container, returns UINT_NULL.
[in] | vi | the index of the adjacent vertex to search. |
|
inline |
Inserts the given adjacent vertex in the container at the given position.
[in] | i | The position in this container where to insert the adjacent vertex. |
[in] | vi | The index of the vertex to insert in the container. |
|
inline |
Inserts the given adjacent vertex in the container at the given position.
[in] | i | The position in this container where to insert the adjacent vertex. |
[in] | v | The pointer to the adjacent vertex to insert in the container. |
|
inline |
Pushes in the back of the container the given adjacent vertex..
[in] | vi | The index to the vertex to push in the back of the container. |
|
inline |
Pushes in the back of the container the given adjacent vertex.
[in] | v | The pointer to the adjacent vertex to push in the back of the container. |
|
inline |
Resize the container of the adjacent vertices to the given size.
[in] | n | The new size of the adjacent vertices container. |
|
inline |
Sets the adjacent vertex pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent vertex; the value must be between begin() and end(). |
[in] | vi | The index in the vertex container of the adjacent vertex to set. |
|
inline |
Sets the adjacent vertex pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent vertex; the value must be between begin() and end(). |
[in] | v | The pointer to the adjacent vertex to set to the element. |
|
inline |
Sets the adjacent vertex pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent vertex; the value must be between begin() and end(). |
[in] | vi | The index in the vertex container of the adjacent vertex to set. |
|
inline |
Sets the adjacent vertex pointed by the iterator.
[in] | it | the iterator in this container on which set the adjacent vertex; the value must be between begin() and end(). |
[in] | v | The pointer to the adjacent vertex to set to the element. |
|
inline |
Sets the i-th adjacent vertex of the element.
[in] | i | the position in this container on which set the adj vertex; the value must be between 0 and the number of adj vertices. |
[in] | vi | The index in the vertex container of the adjacent vertex to set. |
|
inline |
Sets the i-th adjacent vertex of the element.
[in] | i | the position in this container on which set the adj vertex; the value must be between 0 and the number of adj vertices. |
[in] | v | The pointer to the adjacent vertex to set to this element. |
|
inline |
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to set the "next adjacent vertex after position k", without check if it is less than the number of adjacent vertices. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj vertex; value is modularized on adjVerticesNumber(). |
[in] | vi | The index in the vertex container of the adj vertex to set. |
|
inline |
Sets the i-th adjacent vertex of the element, but using as index the module between i and the number of adjacent vertices. You can use this function if you need to set the "next adjacent vertex after position k", without check if it is less than the number of adjacent vertices. Works also for negative numbers:
[in] | i | the position in this container w.r.t. the position 0 on which set the adj vertex; value is modularized on adjVerticesNumber(). |
[in] | v | The pointer to the adj vertex to set to the element. |
|
inline |
Sets all the adjacent vertices of this element.
If the size of the container is static, the size of the input range must be the same one of the container.
Rng | The type of the range of adjacent vertices to set. The value type of the range must be convertible to a pointer to an AdjacentVertex. |
[in] | r | range of adjacent vertices to set. |
|
inline |
Sets all the adjacent vertices of this element.
If the size of the container is static, the size of the input range must be the same one of the container.
Rng | The type of the range of adjacent vertex indices to set. The value type of the range must be convertible to unsigned integer. |
[in] | r | range of indices of adjacent vertices to set. |