Visual Computing Library
|
The WedgeColors class is a container of colors associated to the wedges of a Face element. More...
#include <vclib/mesh/components/wedge_colors.h>
Public Types | |
using | WedgeColorType = vcl::Color |
Expose the type of the Color. | |
using | WedgeColorsIterator = Base::Iterator |
using | ConstWedgeColorsIterator = Base::ConstIterator |
Public Member Functions | |
WedgeColors ()=default | |
Empty constructor. | |
vcl::Color & | wedgeColor (uint i) |
Returns a reference to the i-th wedge color of the element. | |
const vcl::Color & | wedgeColor (uint i) const |
Returns a const reference to the i-th wedge color of the element. | |
vcl::Color & | wedgeColorMod (int i) |
Returns a reference to the i-th wedge color of the element but using as index the module between i and the number of vertices of the element. You can use this function if you need to get the "next wedge
color after position k", without check if it is less than the number of vertices. Works also for negative numbers: | |
const vcl::Color & | wedgeColorMod (int i) const |
Same of wedgeColorMod(int) but returns a const reference. | |
void | setWedgeColor (uint i, const vcl::Color &c) |
Sets the i-th wedge color of the element. | |
template<Range Rng> requires InputRange<Rng, vcl::Color> | |
void | setWedgeColors (Rng &&r) |
Sets all the wedge colors of the element. | |
WedgeColorsIterator | wedgeColorBegin () |
Returns an iterator to the first wedge color in the container of this component. | |
WedgeColorsIterator | wedgeColorEnd () |
Returns an iterator to the end of the container of this component. | |
ConstWedgeColorsIterator | wedgeColorBegin () const |
Returns a const iterator to the first wedge color in the container of this component. | |
ConstWedgeColorsIterator | wedgeColorEnd () const |
Returns a const iterator to the end of the container of this component. | |
View< WedgeColorsIterator > | wedgeColors () |
Returns a lightweight view object that stores the begin and end iterators of the container of wedge colors 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< ConstWedgeColorsIterator > | wedgeColors () const |
Returns a lightweight const view object that stores the begin and end iterators of the container of wedge colors 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 | __wedgeColors () const |
Static Public Attributes | |
static const int | WEDGE_COLOR_NUMBER = Base::SIZE |
![]() | |
static const bool | TIED_TO_VERTEX_NUMBER = TTVN |
Boolean that tells if this component stores a container having its size tied to the number of the vertices of the Element. | |
static const int | SIZE = N |
Protected Member Functions | |
template<typename Element > | |
void | importFrom (const Element &e, bool=true) |
void | serialize (std::ostream &os) const |
void | deserialize (std::istream &is) |
void | resize (uint n) |
void | pushBack (const vcl::Color &c=vcl::Color()) |
void | insert (uint i, const vcl::Color &c=vcl::Color()) |
void | erase (uint i) |
void | clear () |
![]() | |
void | init () |
Vector< T, N > & | container () |
const Vector< T, N > & | container () const |
template<typename AdDt = AdditionalData> requires (HAS_ADDITIONAL_DATA) | |
AdDt & | additionalData () |
template<typename AdDt = AdditionalData> requires (HAS_ADDITIONAL_DATA) | |
const AdDt & | additionalData () const |
Private Types | |
using | Base = ContainerComponent< WedgeColors< N, ParentElemType, OPT >, CompId::WEDGE_COLORS, vcl::Color, N, void, ParentElemType, !std::is_same_v< ParentElemType, void >, OPT, true > |
Private Member Functions | |
template<typename Element > | |
void | importWedgeColorsFrom (const Element &e) |
Vector< vcl::Color, N > & | colors () |
const Vector< vcl::Color, N > & | colors () const |
Additional Inherited Members | |
![]() | |
using | Iterator = Vector< T, N >::Iterator |
using | ConstIterator = Vector< T, N >::ConstIterator |
The WedgeColors class is a container of colors associated to the wedges of a Face element.
It is a static or dynamic size container of colors, depending on the value of the template argument N (a negative value indicates a dynamic size).
The member functions of this class will be available in the instance of any Element that will contain this component, altough it is usually used (and it makes sense only) on the Face element.
For example, if you have a Face Element f
that has the WedgeColors component, you'll be able to access to this component member functions from f
:
N | The size of the container, that will represent the number of storable wedge colors. If N is negative, the container will be dynamic. In any case, N must be the same of the Vertex Number of the Element that will contain this component. |
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. |
|
default |
Empty constructor.
If the Wedge Colors container size is static, initializes all the Wedge Colors to with the vcl::Color empty constructor, otherwise the container will be empty.
|
inline |
Sets the i-th wedge color of the element.
[in] | i | the position in the container on which set the wedge color; the value must be between 0 and the number of vertices of the element. |
[in] | c | the new wedge color. |
|
inline |
Sets all the wedge colors of the 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 wedge colors to set. The value type of the range must be convertible to a vcl::Color. |
[in] | r | range of colors to set. |
|
inline |
Returns a reference to the i-th wedge color of the element.
You can use this function to set the i-th color of the element:
[in] | i | the index of the wedge color to return. The value must be between 0 and the number of vertices of the element. |
|
inline |
Returns a const reference to the i-th wedge color of the element.
[in] | i | the index of the wedge color to return. The value must be between 0 and the number of vertices of the element. |
|
inline |
Returns an iterator to the first wedge color in the container of this component.
|
inline |
Returns a const iterator to the first wedge color 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 a reference to the i-th wedge color of the element but using as index the module between i and the number of vertices of the element. You can use this function if you need to get the "next wedge color after position k", without check if it is less than the number of vertices. Works also for negative numbers:
[in] | i | the position of the required wedge color in the container, w.r.t. the position 0; value is modularized on vertexNumber(). |
|
inline |
Same of wedgeColorMod(int) but returns a const reference.
[in] | i | the position of the required wedge color in the container, w.r.t. the position 0; value is modularized on vertexNumber(). |
|
inline |
Returns a lightweight view object that stores the begin and end iterators of the container of wedge colors 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 wedge colors 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: