Visual Computing Library
Loading...
Searching...
No Matches
vcl::mesh::FaceContainer< T > Class Template Reference

The FaceContainer class represents a container of Face elements that can be used in a Mesh class. More...

#include <vclib/mesh/containers/face_container.h>

Inheritance diagram for vcl::mesh::FaceContainer< T >:

Public Types

using Face = T
 
using FaceType = T
 
using FaceIterator = Base::ElementIterator
 
using ConstFaceIterator = Base::ConstElementIterator
 

Public Member Functions

 FaceContainer ()=default
 Empty constructor that creates an empty container of Faces.
 
const FaceType & face (uint i) const
 Returns a const reference of the Face at the i-th position in the Face Container of the Mesh, which will be the Face having index = i.
 
FaceType & face (uint i)
 Returns a reference of the Face at the i-th position in the Face Container of the Mesh, which will be the Face having index = i.
 
uint faceNumber () const
 Returns the number of non-deleted Faces contained in the Face container of the Mesh.
 
uint faceContainerSize () const
 Returns the number of Faces (also deleted) contained in the Face container of the Mesh.
 
uint deletedFaceNumber () const
 Returns the number of deleted Faces in the Face container, that is faceContainerSize() - faceNumber().
 
uint addFace ()
 Add a Face to the container, returning its index.
 
template<typename... V>
requires (sizeof...(args) >= 3)
uint addFace (V... args)
 
template<Range Rng>
requires ( InputRange<Rng, typename Face::VertexType*> || InputRange<Rng, uint>)
uint addFace (Rng &&r)
 
uint addFaces (uint n)
 Add an arbitrary number of n Faces, returning the id of the first added Face.
 
void clearFaces ()
 Clears the Face container of the Mesh, deleting all the Faces.
 
void resizeFaces (uint n)
 Resizes the Face container to contain n Faces.
 
void reserveFaces (uint n)
 Reserve a number of Faces in the container of Faces. This is useful when you know (or you have an idea) of how much Faces are going to add into a newly of existing mesh. Calling this function before any addFace() call will avoid unuseful reallocations of the container, saving execution time.
 
void compactFaces ()
 Compacts the FaceContainer, removing all the Faces marked as deleted. Faces indices will change accordingly. The function will automatically take care of updating all the Face pointers contained in the Mesh.
 
void deleteFace (uint i)
 Marks as deleted the Face with the given id.
 
void deleteFace (const FaceType *f)
 Marks as deleted the given Face, before asserting that the Face belongs to this container.
 
uint faceIndexIfCompact (uint i) const
 This is an utility member function that returns the index of an element if the container would be compact, that is the number of non-deleted elements before the Face with the given index.
 
std::vector< uintfaceCompactIndices () const
 Returns a vector that tells, for each actual Face index, the new index that the Face would have in a compacted container. For each deleted Face index, the value of the vector will be UINT_NULL.
 
void updateFaceIndices (const std::vector< uint > &newIndices)
 Updates all the indices and pointers of the Faces of this container that are stored in any container of the mesh, according to the mapping stored in the newIndices vector, that tells for each old Face index, the new Face index.
 
FaceIterator faceBegin (bool jumpDeleted=true)
 Returns an iterator to the beginning of the container.
 
FaceIterator faceEnd ()
 Returns an iterator to the end of the container.
 
ConstFaceIterator faceBegin (bool jumpDeleted=true) const
 Returns a const iterator to the beginning of the container.
 
ConstFaceIterator faceEnd () const
 Returns a const iterator to the end of the container.
 
auto faces (bool jumpDeleted=true)
 Returns a small view object that allows to iterate over the Faces of the containers, providing two member functions begin() and end().
 
auto faces (bool jumpDeleted=true) const
 Returns a small view object that allows to iterate over the Faces of the containers, providing two member functions begin() and end().
 
void enableAllPerFaceOptionalComponents ()
 Enables all the optional components associated to the Face type contained in the FaceContainer.
 
void disableAllPerFaceOptionalComponents ()
 Disables all the optional components associated to the Face type contained in the FaceContainer.
 
bool isPerFaceAdjacentEdgesEnabled () const
 Checks if the Face Optional AdjacentEdges is enabled.
 
void enablePerFaceAdjacentEdges ()
 Enable the Optional AdjacentEdges of the Face.
 
void disablePerFaceAdjacentEdges ()
 Disables the Optional AdjacentEdges of the Face.
 
bool isPerFaceAdjacentFacesEnabled () const
 Checks if the Face Optional AdjacentFaces is enabled.
 
void enablePerFaceAdjacentFaces ()
 Enable the Optional AdjacentFaces of the Face.
 
void disablePerFaceAdjacentFaces ()
 Disables the Optional AdjacentFaces of the Face.
 
bool isPerFaceColorEnabled () const
 Checks if the Face Optional Color is enabled.
 
void enablePerFaceColor ()
 Enable the Optional Color of the Face.
 
void disablePerFaceColor ()
 Disables the Optional Color of the Face.
 
bool isPerFaceMarkEnabled () const
 Checks if the Face Optional Mark is enabled.
 
void enablePerFaceMark ()
 Enable the Optional Mark of the Face.
 
void disablePerFaceMark ()
 Disables the Optional Mark of the Face.
 
bool isPerFaceNormalEnabled () const
 Checks if the Face Optional Normal is enabled.
 
void enablePerFaceNormal ()
 Enable the Optional Normal of the Face.
 
void disablePerFaceNormal ()
 Disables the Optional Normal of the Face.
 
bool isPerFacePrincipalCurvatureEnabled () const
 Checks if the Face Optional PrincipalCurvature is enabled.
 
void enablePerFacePrincipalCurvature ()
 Enable the Optional PrincipalCurvature of the Face.
 
void disablePerFacePrincipalCurvature ()
 Disables the Optional PrincipalCurvature of the Face.
 
bool isPerFaceQualityEnabled () const
 Checks if the Face Optional Quality is enabled.
 
void enablePerFaceQuality ()
 Enable the Optional Quality of the Face.
 
void disablePerFaceQuality ()
 Disables the Optional Quality of the Face.
 
bool isPerFaceWedgeColorsEnabled () const
 Checks if the Face Optional WedgeColors is enabled.
 
void enablePerFaceWedgeColors ()
 Enable the Optional WedgeColors of the Face.
 
void disablePerFaceWedgeColors ()
 Disables the Optional WedgeColors of the Face.
 
bool isPerFaceWedgeTexCoordsEnabled () const
 Checks if the Face Optional WedgeTexCoords is enabled.
 
void enablePerFaceWedgeTexCoords ()
 Enable the Optional WedgeTexCoords of the Face.
 
void disablePerFaceWedgeTexCoords ()
 Disables the Optional WedgeTexCoords of the Face.
 
bool hasPerFaceCustomComponent (const std::string &name) const
 Checks if Faces have a custom component with the given name.
 
std::vector< std::string > perFaceCustomComponentNames () const
 Returns a vector containing all the names of the custom components of any type associated to the Face Element.
 
template<typename K >
requires face::HasCustomComponents<T>
bool isPerFaceCustomComponentOfType (const std::string &name) const
 Checks if the custom component of the Face Element having the given name has the same type of the given template argument type of this function.
 
std::type_index perFaceCustomComponentType (const std::string &name) const
 Returns the std::type_index of the custom component of the Face Element having the given input name.
 
template<typename K >
requires face::HasCustomComponents<T>
std::vector< std::string > perFaceCustomComponentNamesOfType () const
 Returns a vector containing all the names of the custom components associated to the Edge Element having the same type of the given template argument type of this function.
 
template<typename K >
requires face::HasCustomComponents<T>
void addPerFaceCustomComponent (const std::string &name)
 Adds a custom component of type K to the Face, having the given name.
 
void deletePerFaceCustomComponent (const std::string &name)
 Deletes the custom component of the given name from the Face Element.
 
template<typename K >
requires face::HasCustomComponents<T>
CustomComponentVectorHandle< K > perFaceCustomComponentVectorHandle (const std::string &name)
 Returns a vector handle to the custom component having the type K and the given name.
 
template<typename K >
requires face::HasCustomComponents<T>
ConstCustomComponentVectorHandle< K > perFaceCustomComponentVectorHandle (const std::string &name) const
 Returns a const vector handle to the custom component having type K and the given name.
 

Protected Member Functions

template<typename OthMesh >
void manageImportTriFromPoly (const OthMesh &m)
 This function manages the case where we try to import into a TriMesh a PolyMesh Faces have been already imported, but without vertex pointers and other components that depend on the number of vertices (e.g. wedges)
 

Private Types

using FaceContainerType = FaceContainer< T >
 
using Base = ElementContainer< T >
 

Private Member Functions

void addFaceHelper (T &f)
 
template<typename... V>
void addFaceHelper (T &f, typename T::VertexType *v, V... args)
 
template<typename... V>
void addFaceHelper (T &f, uint vid, V... args)
 

Static Private Member Functions

template<typename MFaceType , typename VertexType , typename MVertexType >
static void importTriPointersHelper (FaceType &f, const MFaceType &mf, VertexType *base, const MVertexType *mvbase, const std::vector< uint > &tris, uint basetri)
 

Detailed Description

template<FaceConcept T>
class vcl::mesh::FaceContainer< T >

The FaceContainer class represents a container of Face elements that can be used in a Mesh class.

This class adds a container (vector) of Faces to the Mesh, making available the accessors members to them and their components.

It provides all the add, delete, reserve, compact and other functions to manage the Faces, plus the iterators and views to iterate over them. It also provides the functions to enable and disable the optional components of the Faces.

Template Parameters
TThe type of the Face elements. It must satisfy the FaceConcept.

Member Function Documentation

◆ addFace()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::addFace ( )
inline

Add a Face to the container, returning its index.

If the call of this function will cause a reallocation of the FaceContainer, the function will automatically take care of updating all the Face pointers contained in the Mesh.

Returns
the id of the newly added Face.

◆ addFaces()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::addFaces ( uint  n)
inline

Add an arbitrary number of n Faces, returning the id of the first added Face.

This means that, if you want to add 5 Faces and this member function returns 4, the added Faces will have id from 4 to id 8 included.

If the call of this function will cause a reallocation of the FaceContainer, the function will automatically take care of updating all the Face pointers contained in the Mesh.

Parameters
nthe number of Faces to add to the mesh.
Returns
the id of the first added Face.

◆ addPerFaceCustomComponent()

template<FaceConcept T>
template<typename K >
requires face::HasCustomComponents<T>
void vcl::mesh::FaceContainer< T >::addPerFaceCustomComponent ( const std::string &  name)
inline

Adds a custom component of type K to the Face, having the given name.

Note
This function is available only if the Face Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component added to the Face.
Parameters
[in]namethe name of the custom component added to the Face.

◆ clearFaces()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::clearFaces ( )
inline

Clears the Face container of the Mesh, deleting all the Faces.

The contained faces are actually removed from the container, not only marked as deleted. Therefore, the container will have size 0 (faceContainerSize() == 0) after the call of this function.

Note
This function does not cause a reallocation of the Face container.
Warning
Any pointer to Faces in the Mesh will be left unchanged, and therefore will point to invalid Faces. This means that, if you have a pointer to a Face and you call this function, you will have a dangling pointer.

◆ deletedFaceNumber()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::deletedFaceNumber ( ) const
inline

Returns the number of deleted Faces in the Face container, that is faceContainerSize() - faceNumber().

Returns
The number of deleted Faces in the container.

◆ deleteFace() [1/2]

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::deleteFace ( const FaceType *  f)
inline

Marks as deleted the given Face, before asserting that the Face belongs to this container.

This member function does not perform any reallocation of the Faces: the deleted Faces will stay in the Face Container, but will be marked as deleted.

Deleted Faces are automatically jumped by the iterators provided by the Face Container.

Parameters
[in]fthe pointer of the Face that will be marked as deleted.

◆ deleteFace() [2/2]

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::deleteFace ( uint  i)
inline

Marks as deleted the Face with the given id.

This member function does not perform any reallocation of the Faces: the deleted Faces will stay in the Face Container, but will be marked as deleted.

Deleted Faces are automatically jumped by the iterators provided by the Face Container.

Parameters
[in]ithe id of the Face that will be marked as deleted.

◆ deletePerFaceCustomComponent()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::deletePerFaceCustomComponent ( const std::string &  name)
inline

Deletes the custom component of the given name from the Face Element.

The function does nothing if the custom component does not exists.

Note
This function is available only if the Face Element has the CustomComponents Component.
Parameters
[in]namethe name of the custom component that will be removed from the Face.

◆ disablePerFaceAdjacentEdges()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceAdjacentEdges ( )
inline

Disables the Optional AdjacentEdges of the Face.

Note
This function is available only if the Face Element has the OptionalAdjacentEdges Component.

◆ disablePerFaceAdjacentFaces()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceAdjacentFaces ( )
inline

Disables the Optional AdjacentFaces of the Face.

Note
This function is available only if the Face Element has the OptionalAdjacentFaces Component.

◆ disablePerFaceColor()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceColor ( )
inline

Disables the Optional Color of the Face.

Note
This function is available only if the Face Element has the OptionalColor Component.

◆ disablePerFaceMark()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceMark ( )
inline

Disables the Optional Mark of the Face.

Note
This function is available only if the Face Element has the OptionalMark Component.

◆ disablePerFaceNormal()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceNormal ( )
inline

Disables the Optional Normal of the Face.

Note
This function is available only if the Face Element has the OptionalNormal Component.

◆ disablePerFacePrincipalCurvature()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFacePrincipalCurvature ( )
inline

Disables the Optional PrincipalCurvature of the Face.

Note
This function is available only if the Face Element has the OptionalPrincipalCurvature Component.

◆ disablePerFaceQuality()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceQuality ( )
inline

Disables the Optional Quality of the Face.

Note
This function is available only if the Face Element has the OptionalQuality Component.

◆ disablePerFaceWedgeColors()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceWedgeColors ( )
inline

Disables the Optional WedgeColors of the Face.

Note
This function is available only if the Face Element has the OptionalWedgeColors Component.

◆ disablePerFaceWedgeTexCoords()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::disablePerFaceWedgeTexCoords ( )
inline

Disables the Optional WedgeTexCoords of the Face.

Note
This function is available only if the Face Element has the OptionalWedgeTexCoords Component.

◆ enablePerFaceAdjacentEdges()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceAdjacentEdges ( )
inline

Enable the Optional AdjacentEdges of the Face.

Note
This function is available only if the Face Element has the OptionalAdjacentEdges Component.
If the Face is polygonal (dynamic size, N < 0), when enabled, the adjacent edges number will be the same of the vertex number for each face of the container. This is because, for Faces, Adjacent Edges number is tied to the number of vertices.

◆ enablePerFaceAdjacentFaces()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceAdjacentFaces ( )
inline

Enable the Optional AdjacentFaces of the Face.

Note
This function is available only if the Face Element has the OptionalAdjacentFaces Component.
If the Face is polygonal (dynamic size, N < 0), when enabled, the adjacent faces number will be the same of the vertex number for each face of the container. This is because, for Faces, Adjacent Faces number is tied to the number of vertices.

◆ enablePerFaceColor()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceColor ( )
inline

Enable the Optional Color of the Face.

Note
This function is available only if the Face Element has the OptionalColor Component.

◆ enablePerFaceMark()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceMark ( )
inline

Enable the Optional Mark of the Face.

Note
This function is available only if the Face Element has the OptionalMark Component.

◆ enablePerFaceNormal()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceNormal ( )
inline

Enable the Optional Normal of the Face.

Note
This function is available only if the Face Element has the OptionalNormal Component.

◆ enablePerFacePrincipalCurvature()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFacePrincipalCurvature ( )
inline

Enable the Optional PrincipalCurvature of the Face.

Note
This function is available only if the Face Element has the OptionalPrincipalCurvature Component.

◆ enablePerFaceQuality()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceQuality ( )
inline

Enable the Optional Quality of the Face.

Note
This function is available only if the Face Element has the OptionalQuality Component.

◆ enablePerFaceWedgeColors()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceWedgeColors ( )
inline

Enable the Optional WedgeColors of the Face.

Note
This function is available only if the Face Element has the OptionalWedgeColors Component.
If the Face is polygonal (dynamic size, N < 0), when enabled, the wedge colors number will be the same of the vertex number for each face of the container. This is because, for Faces, Wedge Colors number is tied to the number of vertices.

◆ enablePerFaceWedgeTexCoords()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::enablePerFaceWedgeTexCoords ( )
inline

Enable the Optional WedgeTexCoords of the Face.

Note
This function is available only if the Face Element has the OptionalWedgeTexCoords Component.
If the Face is polygonal (dynamic size, N < 0), when enabled, the wedge texcoord number will be the same of the vertex number for each face of the container. This is because, for Faces, Wedge TexCoords number is tied to the number of vertices.

◆ face() [1/2]

template<FaceConcept T>
FaceType & vcl::mesh::FaceContainer< T >::face ( uint  i)
inline

Returns a reference of the Face at the i-th position in the Face Container of the Mesh, which will be the Face having index = i.

This function does not perform any sanity check: if i is less than faceContainerSize(), this function will return a valid Face reference (note that the Face may have been flagged as deleted).

Parameters
[in]ithe index of the Face that will be returned.

◆ face() [2/2]

template<FaceConcept T>
const FaceType & vcl::mesh::FaceContainer< T >::face ( uint  i) const
inline

Returns a const reference of the Face at the i-th position in the Face Container of the Mesh, which will be the Face having index = i.

This function does not perform any sanity check: if i is less than faceContainerSize(), this function will return a valid Face reference (note that the Face may have been flagged as deleted).

Parameters
[in]ithe index of the Face that will be returned.

◆ faceBegin() [1/2]

template<FaceConcept T>
FaceIterator vcl::mesh::FaceContainer< T >::faceBegin ( bool  jumpDeleted = true)
inline

Returns an iterator to the beginning of the container.

The iterator is automatically initialized to jump deleted Faces of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeletedboolean that tells if the iterator should jump deleted Faces.
Returns
An iterator the the first Face of the container.

◆ faceBegin() [2/2]

template<FaceConcept T>
ConstFaceIterator vcl::mesh::FaceContainer< T >::faceBegin ( bool  jumpDeleted = true) const
inline

Returns a const iterator to the beginning of the container.

The iterator is automatically initialized to jump deleted Faces of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeletedboolean that tells if the iterator should jump deleted Faces.
Returns
A const iterator the the first Face of the container.

◆ faceCompactIndices()

template<FaceConcept T>
std::vector< uint > vcl::mesh::FaceContainer< T >::faceCompactIndices ( ) const
inline

Returns a vector that tells, for each actual Face index, the new index that the Face would have in a compacted container. For each deleted Face index, the value of the vector will be UINT_NULL.

This is useful if you need to know the indices of the Faces that they would have in a compact container, without considering the deleted ones.

Returns
A vector containing, for each Face index, its index if the container would be compact.

◆ faceContainerSize()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::faceContainerSize ( ) const
inline

Returns the number of Faces (also deleted) contained in the Face container of the Mesh.

If faceNumber() != faceContainerSize(), it means that there are some Faces that are flagged as deleted.

Returns
the number of all the Faces contained in the Mesh.

◆ faceEnd() [1/2]

template<FaceConcept T>
FaceIterator vcl::mesh::FaceContainer< T >::faceEnd ( )
inline

Returns an iterator to the end of the container.

Returns
An iterator to the end of the container.

◆ faceEnd() [2/2]

template<FaceConcept T>
ConstFaceIterator vcl::mesh::FaceContainer< T >::faceEnd ( ) const
inline

Returns a const iterator to the end of the container.

Returns
A const iterator to the end of the container.

◆ faceIndexIfCompact()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::faceIndexIfCompact ( uint  i) const
inline

This is an utility member function that returns the index of an element if the container would be compact, that is the number of non-deleted elements before the Face with the given index.

Complexity: O(n), with n the number of Faces in the container.

This function does not perform any sanity check on the given index.

Parameters
[in]ithe index of a Face of the container.
Returns
The index that the Face with index i would have if this container would be compact.

◆ faceNumber()

template<FaceConcept T>
uint vcl::mesh::FaceContainer< T >::faceNumber ( ) const
inline

Returns the number of non-deleted Faces contained in the Face container of the Mesh.

If faceNumber() != faceContainerSize(), it means that there are some Faces that are flagged as deleted.

Returns
the number of non-deleted Faces of the Mesh.

◆ faces() [1/2]

template<FaceConcept T>
auto vcl::mesh::FaceContainer< T >::faces ( bool  jumpDeleted = true)
inline

Returns a small view object that allows to iterate over the Faces of the containers, providing two member functions begin() and end().

This member function is very useful when you want to iterate over the Faces using the C++ foreach syntax:

for (Face& e : m.faces()){
// do something with this Face
}
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
auto faces(bool jumpDeleted=true)
Returns a small view object that allows to iterate over the Faces of the containers,...
Definition face_container.h:447

The iterator used to iterate over Faces is automatically initialized to jump deleted Faces of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeletedboolean that tells if the iterator should jump deleted Faces.
Returns
An object having begin() and end() function, allowing to iterate over the container.

◆ faces() [2/2]

template<FaceConcept T>
auto vcl::mesh::FaceContainer< T >::faces ( bool  jumpDeleted = true) const
inline

Returns a small view object that allows to iterate over the Faces of the containers, providing two member functions begin() and end().

This member function is very useful when you want to iterate over the Faces using the C++ foreach syntax:

for (const Face& e : m.faces()){
// do something with this Face
}

The iterator used to iterate over Faces is automatically initialized to jump deleted Faces of the container. You can change this option by calling this function with jumpDeleted=false.

Parameters
[in]jumpDeletedboolean that tells if the iterator should jump deleted Faces.
Returns
An object having begin() and end() function, allowing to iterate over the container.

◆ hasPerFaceCustomComponent()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::hasPerFaceCustomComponent ( const std::string &  name) const
inline

Checks if Faces have a custom component with the given name.

This function does not take into account the type of the custom component.

Note
This function is available only if the Face Element has the CustomComponents Component.
Returns
true if the Face Element has a custom component with the given name.

◆ isPerFaceAdjacentEdgesEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceAdjacentEdgesEnabled ( ) const
inline

Checks if the Face Optional AdjacentEdges is enabled.

Note
This function is available only if the Face Element has the OptionalAdjacentEdges Component.
Returns
true if the Optional AdjacentEdges is enabled, false otherwise.

◆ isPerFaceAdjacentFacesEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceAdjacentFacesEnabled ( ) const
inline

Checks if the Face Optional AdjacentFaces is enabled.

Note
This function is available only if the Face Element has the OptionalAdjacentFaces Component.
Returns
true if the Optional AdjacentFaces is enabled, false otherwise.

◆ isPerFaceColorEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceColorEnabled ( ) const
inline

Checks if the Face Optional Color is enabled.

Note
This function is available only if the Face Element has the OptionalColor Component.
Returns
true if the Optional Color is enabled, false otherwise.

◆ isPerFaceCustomComponentOfType()

template<FaceConcept T>
template<typename K >
requires face::HasCustomComponents<T>
bool vcl::mesh::FaceContainer< T >::isPerFaceCustomComponentOfType ( const std::string &  name) const
inline

Checks if the custom component of the Face Element having the given name has the same type of the given template argument type of this function.

For example, the following code checks if the component called cc is of type double:

if (m.isPerFaceCustomComponentOfType<double>("cc")) {
...
}
Note
This function is available only if the Face Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component to check.
Parameters
[in]namethe name of the custom component to check.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
true if the custom component is of the same type of the template argument.

◆ isPerFaceMarkEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceMarkEnabled ( ) const
inline

Checks if the Face Optional Mark is enabled.

Note
This function is available only if the Face Element has the OptionalMark Component.
Returns
true if the Optional Mark is enabled, false otherwise.

◆ isPerFaceNormalEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceNormalEnabled ( ) const
inline

Checks if the Face Optional Normal is enabled.

Note
This function is available only if the Face Element has the OptionalNormal Component.
Returns
true if the Optional Normal is enabled, false otherwise.

◆ isPerFacePrincipalCurvatureEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFacePrincipalCurvatureEnabled ( ) const
inline

Checks if the Face Optional PrincipalCurvature is enabled.

Note
This function is available only if the Face Element has the OptionalPrincipalCurvature Component.
Returns
true if the Optional PrincipalCurvature is enabled, false otherwise.

◆ isPerFaceQualityEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceQualityEnabled ( ) const
inline

Checks if the Face Optional Quality is enabled.

Note
This function is available only if the Face Element has the OptionalQuality Component.
Returns
true if the Optional Quality is enabled, false otherwise.

◆ isPerFaceWedgeColorsEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceWedgeColorsEnabled ( ) const
inline

Checks if the Face Optional WedgeColors is enabled.

Note
This function is available only if the Face Element has the OptionalWedgeColors Component.
Returns
true if the Optional WedgeColors is enabled, false otherwise.

◆ isPerFaceWedgeTexCoordsEnabled()

template<FaceConcept T>
bool vcl::mesh::FaceContainer< T >::isPerFaceWedgeTexCoordsEnabled ( ) const
inline

Checks if the Face Optional WedgeTexCoords is enabled.

Note
This function is available only if the Face Element has the OptionalWedgeTexCoords Component.
Returns
true if the Optional WedgeTexCoords is enabled, false otherwise.

◆ perFaceCustomComponentNames()

template<FaceConcept T>
std::vector< std::string > vcl::mesh::FaceContainer< T >::perFaceCustomComponentNames ( ) const
inline

Returns a vector containing all the names of the custom components of any type associated to the Face Element.

Note
This function is available only if the Face Element has the CustomComponents Component.
Returns
A vector of strings representing all the names of the custom components.

◆ perFaceCustomComponentNamesOfType()

template<FaceConcept T>
template<typename K >
requires face::HasCustomComponents<T>
std::vector< std::string > vcl::mesh::FaceContainer< T >::perFaceCustomComponentNamesOfType ( ) const
inline

Returns a vector containing all the names of the custom components associated to the Edge Element having the same type of the given template argument type of this function.

For example, the following code gets a vector containing all the custom components of type double:

std::vector<std::string> cdouble =
m.perFaceCustomComponentNamesOfType<double>();
Note
This function is available only if the Face Element has the CustomComponents Component.
Template Parameters
Kthe type of the custom component names.
Returns
A vector of strings representing the names of the custom components of a given type.

◆ perFaceCustomComponentType()

template<FaceConcept T>
std::type_index vcl::mesh::FaceContainer< T >::perFaceCustomComponentType ( const std::string &  name) const
inline

Returns the std::type_index of the custom component of the Face Element having the given input name.

Note
This function is available only if the Face Element has the CustomComponents Component.
Parameters
[in]namethe name of the custom component to get the std::type_index from.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
The std::type_index of the custom component having the given input name.

◆ perFaceCustomComponentVectorHandle() [1/2]

template<FaceConcept T>
template<typename K >
requires face::HasCustomComponents<T>
CustomComponentVectorHandle< K > vcl::mesh::FaceContainer< T >::perFaceCustomComponentVectorHandle ( const std::string &  name)
inline

Returns a vector handle to the custom component having the type K and the given name.

The handle can be used like a normal std::vector, but does not have access to the modifiers member functions (resize, push_back...). The handle contains references to the custom component, therefore you can modify the custom component by modifying the element of the handle vector normally. Since the handle stores references, there are no copies performed when calling this function.

For example, assuming that the mesh has a Face custom component named cc of type int:

auto handle = m.getPerFaceCustomComponentVectorHandle<int>("cc");
for (Face& e : m.faces() {
handle[m.index(e)] = 5; // e.customComponent<int>("cc") == 5
assert(e.customComponent<int>("cc") == 5);
}

Using handles allows to access more efficiently to custom components rather accessing from an element object. However, note that references are binded to the container of the mesh.

Note
This function is available only if the Face Element has the CustomComponents Component.
Since the handle contains references, any operation that changes the size of the container could be destructive and invalidate the references contained in the handle.
Template Parameters
Kthe type of the custom component on which return the handle.
Parameters
[in]namename of the custom component on which return the handle.
Exceptions
std::out_of_rangeif no custom component of the given name was found.
Returns
a vector handle that allows to access to the custom component.

◆ perFaceCustomComponentVectorHandle() [2/2]

template<FaceConcept T>
template<typename K >
requires face::HasCustomComponents<T>
ConstCustomComponentVectorHandle< K > vcl::mesh::FaceContainer< T >::perFaceCustomComponentVectorHandle ( const std::string &  name) const
inline

Returns a const vector handle to the custom component having type K and the given name.

The handle can be used like a normal std::vector, but does not have access to the modifiers member functions (resize, push_back...). The handle contains const references to the custom component, therefore you can access to the custom component by accessing the element of the handle vector normally. Since the handle stores references, there are no copies performed when calling this function.

For example, assuming that the mesh has a Face custom component named cc of type int:

// access to the const handle by making const the template parameter:
auto handle = m.perFaceCustomComponentVectorHandle<const int>("cc");
int sum = 0;
for (const Face& e : m.faces() {
sum += handle[m.index(e)];
// handle[m.index(e)] = 5; // not allowed, because the handle is const
}

Using handles allows to access more efficiently to custom components rather accessing from an element object. However, note that references are binded to the container of the mesh.

Note
This function is available only if the Face Element has the CustomComponents Component.
Since the handle contains references, any operation that changes the size of the container could be destructive and invalidate the references contained in the handle.
Template Parameters
Kthe type of the custom component on which return the handle.
Parameters
[in]namename of the custom component on which return the handle.
Returns
a const vector handle that allows to access to the custom component.

◆ reserveFaces()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::reserveFaces ( uint  n)
inline

Reserve a number of Faces in the container of Faces. This is useful when you know (or you have an idea) of how much Faces are going to add into a newly of existing mesh. Calling this function before any addFace() call will avoid unuseful reallocations of the container, saving execution time.

The filosofy of this function is similar to the one of the reserve() function of the std::vector class.

If the call of this function will cause a reallocation of the Face container, the function will automatically take care of updating all the Face pointers contained in the Mesh.

Parameters
nthe new capacity of the Face container.

◆ resizeFaces()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::resizeFaces ( uint  n)
inline

Resizes the Face container to contain n Faces.

If the new size is greater than the old one, new Faces are added to the container, and a reallocation may happen. If the new size is smaller than the old one, the container will keep its first non-deleted n Faces, and the remaining Faces are marked as deleted.

If the call of this function will cause a reallocation of the Face container, the function will automatically take care of updating all the Face pointers contained in the Mesh.

Warning
The given size n is relative to the number of non-deleted Faces, not to the size of the Face container. For example, if you have a mesh with 10 Faces and faceContainerSize() == 20, calling resizeFaces(5) will not cause a reallocation of the container, but will mark as deleted the least 5 non-deleted Faces of the container. In the same scenario, calling resizeFaces(15) will result in a Face container having 15 Faces and faceContainerSize() == 25. The latest 5 Faces will be the newly added.
Any pointer to deleted Faces in the Mesh will be left unchanged, and therefore will point to invalid Faces. This means that if you call this member function with a lower number of Faces, you'll need to manually manage the pointers to the deleted Faces.
Parameters
[in]nthe new size of the Face container.

◆ updateFaceIndices()

template<FaceConcept T>
void vcl::mesh::FaceContainer< T >::updateFaceIndices ( const std::vector< uint > &  newIndices)
inline

Updates all the indices and pointers of the Faces of this container that are stored in any container of the mesh, according to the mapping stored in the newIndices vector, that tells for each old Face index, the new Face index.

This function is useful when delete some Faces, and you want to update the indices/pointers stored in all the containers of the mesh accordingly.

E.g. Supposing you deleted a set of Faces, you can give to this function the vector telling, for each one of the old Face indices, the new Face index (or UINT_NULL if you want to leave it unreferenced). This function will update all the pointers stored in the mesh containers accordingly (if they store adjacencies to the Faces).

Note
This function does not change the position of the Faces in this container. It just updates the indices/pointers of the Faces stored in this or other containers.
Parameters
[in]newIndicesa vector that tells, for each old Face index, the new Face index. If the old Face must be left as unreferenced (setting nullptr to the pointers), the value of the vector must be UINT_NULL.

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