Visual Computing Library
Loading...
Searching...
No Matches
vcl::comp::WedgeColors< N, ParentElemType, OPT > Class Template Reference

The WedgeColors class is a container of colors associated to the wedges of a Face element. More...

#include <vclib/mesh/components/wedge_colors.h>

Inheritance diagram for vcl::comp::WedgeColors< N, ParentElemType, OPT >:

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::ColorwedgeColor (uint i)
 Returns a reference to the i-th wedge color of the element.
 
const vcl::ColorwedgeColor (uint i) const
 Returns a const reference to the i-th wedge color of the element.
 
vcl::ColorwedgeColorMod (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::ColorwedgeColorMod (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 Public Attributes inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
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 ()
 
- Protected Member Functions inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
void init ()
 
Vector< T, N > & container ()
 
const Vector< T, N > & container () const
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
AdDtadditionalData ()
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
const AdDtadditionalData () 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

- Protected Types inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
using Iterator = Vector< T, N >::Iterator
 
using ConstIterator = Vector< T, N >::ConstIterator
 

Detailed Description

template<int N, typename ParentElemType = void, bool OPT = false>
class vcl::comp::WedgeColors< N, ParentElemType, OPT >

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:

vcl::Color c = f.wedgeColor(0);
The Color class represents a 32 bit color.
Definition color.h:48
Note
This component is Tied To Vertex Number: it means that the size of the container, if dynamic, will change automatically along the Vertex Number of the Component. For further details check the documentation of the ContainerComponent class.
Template Parameters
NThe 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.
ParentElemTypeThis 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.
OPTIf true, the component will be optional. This argument is considered only if the component is stored vertically.

Constructor & Destructor Documentation

◆ WedgeColors()

template<int N, typename ParentElemType = void, bool OPT = false>
vcl::comp::WedgeColors< N, ParentElemType, OPT >::WedgeColors ( )
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.

Member Function Documentation

◆ setWedgeColor()

template<int N, typename ParentElemType = void, bool OPT = false>
void vcl::comp::WedgeColors< N, ParentElemType, OPT >::setWedgeColor ( uint  i,
const vcl::Color c 
)
inline

Sets the i-th wedge color of the element.

Parameters
[in]ithe 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]cthe new wedge color.

◆ setWedgeColors()

template<int N, typename ParentElemType = void, bool OPT = false>
template<Range Rng>
requires InputRange<Rng, vcl::Color>
void vcl::comp::WedgeColors< N, ParentElemType, OPT >::setWedgeColors ( Rng &&  r)
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.

Template Parameters
RngThe type of the range of wedge colors to set. The value type of the range must be convertible to a vcl::Color.
Parameters
[in]rrange of colors to set.

◆ wedgeColor() [1/2]

template<int N, typename ParentElemType = void, bool OPT = false>
vcl::Color & vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColor ( uint  i)
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:

f.wedgeColor(0) = vcl::Color::Red;
Parameters
[in]ithe index of the wedge color to return. The value must be between 0 and the number of vertices of the element.
Returns
A reference to the i-th wedge color of the element.

◆ wedgeColor() [2/2]

template<int N, typename ParentElemType = void, bool OPT = false>
const vcl::Color & vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColor ( uint  i) const
inline

Returns a const reference to the i-th wedge color of the element.

Parameters
[in]ithe index of the wedge color to return. The value must be between 0 and the number of vertices of the element.
Returns
A const reference to the i-th wedge color of the element.

◆ wedgeColorBegin() [1/2]

template<int N, typename ParentElemType = void, bool OPT = false>
WedgeColorsIterator vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorBegin ( )
inline

Returns an iterator to the first wedge color in the container of this component.

Returns
an iterator pointing to the begin of this container.

◆ wedgeColorBegin() [2/2]

template<int N, typename ParentElemType = void, bool OPT = false>
ConstWedgeColorsIterator vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorBegin ( ) const
inline

Returns a const iterator to the first wedge color in the container of this component.

Returns
a const iterator pointing to the begin of this container.

◆ wedgeColorEnd() [1/2]

template<int N, typename ParentElemType = void, bool OPT = false>
WedgeColorsIterator vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorEnd ( )
inline

Returns an iterator to the end of the container of this component.

Returns
an iterator pointing to the end of this container.

◆ wedgeColorEnd() [2/2]

template<int N, typename ParentElemType = void, bool OPT = false>
ConstWedgeColorsIterator vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorEnd ( ) const
inline

Returns a const iterator to the end of the container of this component.

Returns
an iterator pointing to the end of this container.

◆ wedgeColorMod() [1/2]

template<int N, typename ParentElemType = void, bool OPT = false>
vcl::Color & vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorMod ( int  i)
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:

f.wedgeColorMod(-1) = vcl::Color::Red; // the wedge color in position
// vertexNumber() - 1
Parameters
[in]ithe position of the required wedge color in the container, w.r.t. the position 0; value is modularized on vertexNumber().
Returns
A reference to the required wedge color of the element.

◆ wedgeColorMod() [2/2]

template<int N, typename ParentElemType = void, bool OPT = false>
const vcl::Color & vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColorMod ( int  i) const
inline

Same of wedgeColorMod(int) but returns a const reference.

Parameters
[in]ithe position of the required wedge color in the container, w.r.t. the position 0; value is modularized on vertexNumber().
Returns
A const reference to the required wedge color of the element.

◆ wedgeColors() [1/2]

template<int N, typename ParentElemType = void, bool OPT = false>
View< WedgeColorsIterator > vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColors ( )
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:

for (auto& wc : el.wedgeColors()) {
// Do something with wc
}
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
View< WedgeColorsIterator > wedgeColors()
Returns a lightweight view object that stores the begin and end iterators of the container of wedge c...
Definition wedge_colors.h:250
Returns
a lightweight view object that can be used in range-based for loops to iterate over wedge colors.

◆ wedgeColors() [2/2]

template<int N, typename ParentElemType = void, bool OPT = false>
View< ConstWedgeColorsIterator > vcl::comp::WedgeColors< N, ParentElemType, OPT >::wedgeColors ( ) const
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:

for (const auto& wc : el.wedgeColors()) {
// Do something read-only with wc
}
Returns
a lightweight view object that can be used in range-based for loops to iterate over wedge colors.

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