Visual Computing Library
Loading...
Searching...
No Matches
Update Mesh Algorithms

List of Mesh Update algorithms. More...

Collaboration diagram for Update Mesh Algorithms:

Functions

template<HasBoundingBox MeshType>
void vcl::updateBoundingBox (MeshType &m)
 Updates the bounding box of the mesh.
 
template<MeshConcept MeshType>
void vcl::setPerVertexColor (MeshType &m, Color c=Color::White, bool onlySelected=false)
 Sets the color of the vertices. If the onlySelected flag is set to true, only the color of the selected vertices will be set. Otherwise, all the vertices will have the same color.
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColor (MeshType &m, Color c=Color::White, bool onlySelected=false)
 Sets the color of the faces. If the onlySelected flag is set to true, only the color of the selected faces will be set. Otherwise, all the faces will have the same color.
 
template<EdgeMeshConcept MeshType>
void vcl::setPerEdgeColor (MeshType &m, Color c=Color::White, bool onlySelected=false)
 Sets the color of the edges. If the onlySelected flag is set to true, only the color of the selected edges will be set. Otherwise, all the edges will have the same color.
 
template<HasColor MeshType>
void vcl::setMeshColor (MeshType &m, Color c=Color::White)
 Sets the color component of a mesh.
 
template<FaceMeshConcept MeshType>
void vcl::setPerVertexColorFromFaceColor (MeshType &m)
 Sets the vertex colors from its incident face colors, computing a plain average of the face colors.
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromVertexColor (MeshType &m)
 Sets the face colors from its incident vertex colors, computing a plain average of the vertex colors.
 
template<EdgeMeshConcept MeshType>
void vcl::setPerEdgeColorFromVertexColor (MeshType &m)
 Sets the edge colors from its incident vertex colors, computing a plain average of the vertex colors.
 
template<MeshConcept MeshType>
void vcl::setPerVertexColorFromQuality (MeshType &m, Color::ColorMap colorMap=Color::ColorMap::RedBlue, typename MeshType::VertexType::QualityType minQuality=0, typename MeshType::VertexType::QualityType maxQuality=0)
 Sets the vertex colors from the quality values by computing a shading in the given color map (default is Red to Blue color map), in the given interval [minQuality, maxQuality].
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromQuality (MeshType &m, Color::ColorMap colorMap=Color::ColorMap::RedBlue, typename MeshType::FaceType::QualityType minQuality=0, typename MeshType::FaceType::QualityType maxQuality=0)
 Sets the face colors from the quality values by computing a shading in the given color map (default is Red to Blue color map), in the given interval [minQuality, maxQuality].
 
template<FaceMeshConcept MeshType>
void vcl::setPerVertexColorFromFaceBorderFlag (MeshType &m, Color borderColor=Color::Blue, Color internalColor=Color::White, Color mixColor=Color::Cyan)
 Color the vertices of the mesh that are on border, using the border flags of the faces.
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromConnectedComponents (MeshType &m, const std::vector< std::set< uint > > &connectedComponents)
 Given an already computed vector of sets of connected components (see vcl::connectedComponents(m) in vclib/algorithms/clean.h), sets face colors according from connected components of the mesh. Each connected component will have a different per face color.
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromConnectedComponents (MeshType &m)
 Sets face colors according from connected components of the mesh. Each connected component will have a different per face color. Since this function will need to compute connected components of the mesh, also per Face AdjacentFaces component is required.
 
template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorScattering (MeshType &m, uint nColors=50, bool checkFauxEdges=true)
 This function colors each face of the mesh using a given number of scattering colors (default number is 50). By default, colors uniformely adjacent faces having faux edges in common. This check is made only if the option checkFauxEdges is set to true, and if the per Face AdjacentFaces component is available in the mesh.
 
template<MeshConcept MeshType, PointConcept PointType>
void vcl::setPerVertexColorPerlinNoise (MeshType &m, PointType period, PointType offset=PointType(0, 0, 0), bool onSelected=false)
 Set the vertex color according to a perlin noise computed on the vertex coordinates.
 
template<MeshConcept MeshType, PointConcept PointType>
void vcl::setPerVertexPerlinColor (MeshType &m, double period, PointType offset=PointType(0, 0, 0), Color color1=Color::Black, Color color2=Color::White, bool onSelected=false)
 Simple Perlin color mixing. color1 and color2 are mixed according the perlin noise function, with period and offset.
 

Detailed Description

List of Mesh Update algorithms.

They allow to update components and properties of a mesh.

You can access these algorithms by including #include <vclib/algorithms/mesh/update.h>

Function Documentation

◆ setMeshColor()

template<HasColor MeshType>
void vcl::setMeshColor ( MeshType &  m,
Color  c = Color::White 
)

Sets the color component of a mesh.

Template Parameters
MeshTypetype of the input mesh. It must satisfy the HasColor concept.
Parameters
[in,out]mthe mesh on which set the color.
[in]cthe color to set to the mesh.

◆ setPerEdgeColor()

template<EdgeMeshConcept MeshType>
void vcl::setPerEdgeColor ( MeshType &  m,
Color  c = Color::White,
bool  onlySelected = false 
)

Sets the color of the edges. If the onlySelected flag is set to true, only the color of the selected edges will be set. Otherwise, all the edges will have the same color.

Exceptions
vcl::MissingComponentExceptionif the mesh does not have the per edge color component available.
Template Parameters
MeshTypetype of the input mesh. It must satisfy the EdgeMeshConcept.
Parameters
[in,out]mthe mesh on which set the edge color.
[in]cthe color to set to the edges of the mesh.
[in]onlySelectedif true, the color will be set just on the selected edges.

◆ setPerEdgeColorFromVertexColor()

template<EdgeMeshConcept MeshType>
void vcl::setPerEdgeColorFromVertexColor ( MeshType &  m)

Sets the edge colors from its incident vertex colors, computing a plain average of the vertex colors.

Requirements:

Parameters
[in,out]mmesh on which transfer the vertex color into the edge color.

◆ setPerFaceColor()

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColor ( MeshType &  m,
Color  c = Color::White,
bool  onlySelected = false 
)

Sets the color of the faces. If the onlySelected flag is set to true, only the color of the selected faces will be set. Otherwise, all the faces will have the same color.

Exceptions
vcl::MissingComponentExceptionif the mesh does not have the per face color component available.
Template Parameters
MeshTypetype of the input mesh. It must satisfy the FaceMeshConcept.
Parameters
[in,out]mthe mesh on which set the face color.
[in]cthe color to set to the faces of the mesh.
[in]onlySelectedif true, the color will be set just on the selected faces.

◆ setPerFaceColorFromConnectedComponents() [1/2]

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromConnectedComponents ( MeshType &  m)

Sets face colors according from connected components of the mesh. Each connected component will have a different per face color. Since this function will need to compute connected components of the mesh, also per Face AdjacentFaces component is required.

Requirements:

Parameters
[in,out]mthe mesh on which set the face colors according to its connected components.

◆ setPerFaceColorFromConnectedComponents() [2/2]

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromConnectedComponents ( MeshType &  m,
const std::vector< std::set< uint > > &  connectedComponents 
)

Given an already computed vector of sets of connected components (see vcl::connectedComponents(m) in vclib/algorithms/clean.h), sets face colors according from connected components of the mesh. Each connected component will have a different per face color.

Requirements:

Parameters
[in,out]mthe mesh on which set the face colors according to its connected components.
[in]connectedComponentsa vector of sets, each one of them containing the face ids of a connected component.

◆ setPerFaceColorFromQuality()

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromQuality ( MeshType &  m,
Color::ColorMap  colorMap = Color::ColorMap::RedBlue,
typename MeshType::FaceType::QualityType  minQuality = 0,
typename MeshType::FaceType::QualityType  maxQuality = 0 
)

Sets the face colors from the quality values by computing a shading in the given color map (default is Red to Blue color map), in the given interval [minQuality, maxQuality].

If minQuality and maxQuality are not set (or if they are equal), the range is automatically computed.

Requirements:

Parameters
[in,out]mmesh on which compute the face color.
[in]colorMapthe colormap to use to color the faces of the mesh (default: RedBlue).
[in]minQualitythe minimum value of the range to use for coloring (default: 0).
[in]maxQualitythe maximum value of the range to use for coloring (default: 0).

◆ setPerFaceColorFromVertexColor()

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorFromVertexColor ( MeshType &  m)

Sets the face colors from its incident vertex colors, computing a plain average of the vertex colors.

Requirements:

Parameters
[in,out]mmesh on which transfer the vertex color into the face color.

◆ setPerFaceColorScattering()

template<FaceMeshConcept MeshType>
void vcl::setPerFaceColorScattering ( MeshType &  m,
uint  nColors = 50,
bool  checkFauxEdges = true 
)

This function colors each face of the mesh using a given number of scattering colors (default number is 50). By default, colors uniformely adjacent faces having faux edges in common. This check is made only if the option checkFauxEdges is set to true, and if the per Face AdjacentFaces component is available in the mesh.

Requirements:

Optional:

  • Mesh:
    • Faces:
      • AdjacentFaces
Parameters
[in,out]mmesh on which set the face colors.
[in]nColorsnumber of colors used for the scattering (default 50).
[in]checkFauxEdgesif true, colors uniformely adjacent faces with faux edges (default true).

◆ setPerVertexColor()

template<MeshConcept MeshType>
void vcl::setPerVertexColor ( MeshType &  m,
Color  c = Color::White,
bool  onlySelected = false 
)

Sets the color of the vertices. If the onlySelected flag is set to true, only the color of the selected vertices will be set. Otherwise, all the vertices will have the same color.

Exceptions
vcl::MissingComponentExceptionif the mesh does not have the per vertex color component available.
Template Parameters
MeshTypetype of the input mesh. It must satisfy the MeshConcept.
Parameters
[in,out]mthe mesh on which set the vertex color.
[in]cthe color to set to the vertices of the mesh.
[in]onlySelectedif true, the color will be set just on the selected vertices.

◆ setPerVertexColorFromFaceBorderFlag()

template<FaceMeshConcept MeshType>
void vcl::setPerVertexColorFromFaceBorderFlag ( MeshType &  m,
Color  borderColor = Color::Blue,
Color  internalColor = Color::White,
Color  mixColor = Color::Cyan 
)

Color the vertices of the mesh that are on border, using the border flags of the faces.

Before using this function, you should update the face border flags accordingly.

Requirements:

  • Mesh:
    • Vertices:
    • Faces:
      • TriangleFlags/PolygonFlags
Parameters
[in,out]mthe mesh on which update the vertex color from the border face flags.
[in]borderColorthe color of the vertices that are part of edges that are all marked as on border.
[in]internalColorthe color of the vertices that are part of edges that are all marked as non on border.
[in]mixColorthe color of vertices that are part of edges that are both on border and non on border.

◆ setPerVertexColorFromFaceColor()

template<FaceMeshConcept MeshType>
void vcl::setPerVertexColorFromFaceColor ( MeshType &  m)

Sets the vertex colors from its incident face colors, computing a plain average of the face colors.

Requirements:

Parameters
[in,out]mmesh on which transfer the face color into the vertex color.

◆ setPerVertexColorFromQuality()

template<MeshConcept MeshType>
void vcl::setPerVertexColorFromQuality ( MeshType &  m,
Color::ColorMap  colorMap = Color::ColorMap::RedBlue,
typename MeshType::VertexType::QualityType  minQuality = 0,
typename MeshType::VertexType::QualityType  maxQuality = 0 
)

Sets the vertex colors from the quality values by computing a shading in the given color map (default is Red to Blue color map), in the given interval [minQuality, maxQuality].

If minQuality and maxQuality are not set (or if they are equal), the range is automatically computed.

Requirements:

Parameters
[in,out]mmesh on which compute the vertex color.
[in]colorMapthe colormap to use to color the vertices of the mesh (default: RedBlue).
[in]minQualitythe minimum value of the range to use for coloring (default: 0).
[in]maxQualitythe maximum value of the range to use for coloring (default: 0).

◆ setPerVertexColorPerlinNoise()

template<MeshConcept MeshType, PointConcept PointType>
void vcl::setPerVertexColorPerlinNoise ( MeshType &  m,
PointType  period,
PointType  offset = PointType(0, 0, 0),
bool  onSelected = false 
)

Set the vertex color according to a perlin noise computed on the vertex coordinates.

To make things weirder each color band can have its own offset and frequency. Period is expressed in absolute terms. So as period it is meaningful could be to use something in the range of 1/10 of the bbox diag.

Exceptions
vcl::MissingComponentExceptionif the mesh does not have a per vertex color component.
Template Parameters
MeshTypethe type of the mesh. It must satisfy the MeshConcept.
Parameters
m
period
offset
onSelected

◆ setPerVertexPerlinColor()

template<MeshConcept MeshType, PointConcept PointType>
void vcl::setPerVertexPerlinColor ( MeshType &  m,
double  period,
PointType  offset = PointType(0, 0, 0),
Color  color1 = Color::Black,
Color  color2 = Color::White,
bool  onSelected = false 
)

Simple Perlin color mixing. color1 and color2 are mixed according the perlin noise function, with period and offset.

Exceptions
vcl::MissingComponentExceptionif the mesh does not have a per vertex color component.
Template Parameters
MeshTypethe type of the mesh. It must satisfy the MeshConcept.
Parameters
m
period
offset
color1
color2
onSelected

◆ updateBoundingBox()

template<HasBoundingBox MeshType>
void vcl::updateBoundingBox ( MeshType &  m)

Updates the bounding box of the mesh.

Template Parameters
MeshTypetype of the input mesh. It must satisfy the HasBoundingBox concept.
Parameters
[in]minput mesh on which the bounding box is computed and updated.