Visual Computing Library
|
The Mark class is an utility class useful to un-mark components in constant time. More...
#include <vclib/mesh/components/mark.h>
Public Member Functions | |
Mark () | |
Constructor that initializes the mark to 0. | |
int | mark () const |
Returns the value of the mark. | |
void | resetMark () |
Resets the mark to 0. | |
template<typename E > | |
bool | hasSameMark (const E &e) const |
Checks if the current element/mesh has the same mark of the given input element/mesh e . | |
void | incrementMark () |
Increments the mark of the current element/mesh by 1. | |
void | decrementMark () |
Decrements the mark of the current element/mesh by 1. | |
Protected Member Functions | |
template<typename Element > | |
void | importFrom (const Element &e, bool=true) |
void | serialize (std::ostream &os) const |
void | deserialize (std::istream &is) |
Private Types | |
using | Base = Component< Mark< ParentElemType, OPT >, CompId::MARK, int, ParentElemType, !std::is_same_v< ParentElemType, void >, OPT > |
Private Member Functions | |
void | init () |
Initializes the mark to 0. | |
int & | markRef () |
The Mark class is an utility class useful to un-mark components in constant time.
Its implementation is just an integer that can be incremented and decremented.
Assuming that two Elements (or a Mesh and an Element) have the Mark component: you can consider one of the elements "marked" if it has the same mark value of the other element/mesh.
Example: suppose that you have a Mesh with Vertex Elements, and both Mesh and Vertices have the Mark component. In initialization, all the elements are considered marked, because the elements have the same mark value of the Mesh. To un-mark all the vertices of the mesh:
Now all the vertices (and all the other elements) are un-marked because they have a different mark value w.r.t. the one of the mesh.
Then, if you want to mark the vertices having index 3 and 5:
And to check if vertices 4 and 5 are marked:
ParentElemType | This template argument must be void if the component needs to be stored horizontally, or the type of the parent element that will contain this component if the component needs to be stored vertically. |
OPT | If true, the component will be optional. This argument is considered only if the component is stored vertically. |
|
inline |
Checks if the current element/mesh has the same mark of the given input element/mesh e
.
E | the type of the input element/mesh. |
e | the input element/mesh. |
|
inlineprivate |
Initializes the mark to 0.
It is made in the init function since the component could be not available during construction (e.g. if the component is optional and not enabled).
This member function is hidden by the element that inherits this class.
|
inline |
Returns the value of the mark.