Visual Computing Library  devel
Loading...
Searching...
No Matches
Import Mesh from Matrix Algorithms

List Import Mesh from Matrix algorithms. More...

Collaboration diagram for Import Mesh from Matrix Algorithms:

Functions

template<EdgeMeshConcept MeshType, MatrixConcept ECMatrix>
void vcl::edgeColorsFromMatrix (MeshType &mesh, const ECMatrix &edgeColors)
 Sets the edge colors of the given input mesh from the input edge colors matrix.
 
template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeColorsFromRange (MeshType &mesh, R &&colors, Color::Format colorFormat)
 Sets the edge colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<EdgeMeshConcept MeshType, MatrixConcept EMatrix>
void vcl::edgeIndicesFromMatrix (MeshType &mesh, const EMatrix &edges, bool clearBeforeSet=true)
 Sets the edge indices of the given input mesh from the input edge matrix.
 
template<EdgeMeshConcept MeshType, MatrixConcept ENMatrix>
void vcl::edgeNormalsFromMatrix (MeshType &mesh, const ENMatrix &edgeNormals)
 Sets the edge normals of the given input mesh from the input edge normals matrix.
 
template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeQualityFromRange (MeshType &mesh, R &&quality)
 Sets the edge quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeSelectionFromRange (MeshType &mesh, R &&selection)
 Sets the edge selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).
 
template<uint ELEM_ID, MeshConcept MeshType, MatrixConcept CMatrix>
void vcl::elementColorsFromMatrix (MeshType &mesh, const CMatrix &colors)
 Sets the element identified by ELEM_ID colors of the given input mesh from the input colors matrix.
 
template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementColorsFromRange (MeshType &mesh, R &&colors, Color::Format colorFormat)
 Sets the element identified by ELEM_ID colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<uint ELEM_ID, MeshConcept MeshType, MatrixConcept NMatrix>
void vcl::elementNormalsFromMatrix (MeshType &mesh, const NMatrix &normals)
 Sets the element identified by ELEM_ID normals of the given input mesh from the input normals matrix.
 
template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementQualityFromRange (MeshType &mesh, R &&quality)
 Sets the element identified by ELEM_ID quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementSelectionFromRange (MeshType &mesh, R &&selection)
 Sets the element identified by ELEM_ID selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).
 
template<FaceMeshConcept MeshType, MatrixConcept FCMatrix>
void vcl::faceColorsFromMatrix (MeshType &mesh, const FCMatrix &faceColors)
 Sets the face colors of the given input mesh from the input face colors matrix.
 
template<FaceMeshConcept MeshType, Range R>
void vcl::faceColorsFromRange (MeshType &mesh, R &&colors, Color::Format colorFormat)
 Sets the face colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<FaceMeshConcept MeshType, MatrixConcept FMatrix>
void vcl::faceIndicesFromMatrix (MeshType &mesh, const FMatrix &faces, bool clearBeforeSet=true)
 Sets the face indices of the given input mesh from the input face matrix.
 
template<FaceMeshConcept MeshType, Range R>
void vcl::faceMaterialIndicesFromRange (MeshType &mesh, R &&texCoordIndices)
 Sets the face material indices of the given input mesh from the input material indices range (that could be anything that satisfies the Range concept: e.g. std::vector<uint>, std::array<uint, N>, Eigen::VectorXi, etc.).
 
template<FaceMeshConcept MeshType, MatrixConcept FNMatrix>
void vcl::faceNormalsFromMatrix (MeshType &mesh, const FNMatrix &faceNormals)
 Sets the face normals of the given input mesh from the input face normals matrix.
 
template<FaceMeshConcept MeshType, Range R>
void vcl::faceQualityFromRange (MeshType &mesh, R &&quality)
 Sets the face quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<FaceMeshConcept MeshType, Range R>
void vcl::faceSelectionFromRange (MeshType &mesh, R &&selection)
 Sets the face selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).
 
template<FaceMeshConcept MeshType, MatrixConcept FTMatrix>
void vcl::faceWedgeTexCoordsFromMatrix (MeshType &mesh, const FTMatrix &faceWedgeTexCoords)
 Sets the face wedge texcoords of the given input mesh from the input face wedge texcoords matrix.
 
template<MeshConcept MeshType, MatrixConcept VMatrix, MatrixConcept FMatrix = Eigen::MatrixX3i, MatrixConcept EMatrix = Eigen::MatrixX2i>
MeshType vcl::meshFromMatrices (const VMatrix &vertices, const FMatrix &faces=FMatrix(), const EMatrix &edges=EMatrix())
 Creates and returns a new mesh from the input matrices that are given as arguments.
 
template<MeshConcept MeshType, MatrixConcept VMatrix, MatrixConcept FMatrix = Eigen::MatrixX3i, MatrixConcept EMatrix = Eigen::MatrixX2i>
void vcl::meshFromMatrices (MeshType &mesh, const VMatrix &vertices, const FMatrix &faces=FMatrix(), const EMatrix &edges=EMatrix())
 Sets the given input mesh from the input matrices that are given as arguments.
 
template<MeshConcept MeshType, MatrixConcept VCMatrix>
void vcl::vertexColorsFromMatrix (MeshType &mesh, const VCMatrix &vertexColors)
 Sets the vertex colors of the given input mesh from the input vertex colors matrix.
 
template<MeshConcept MeshType, Range R>
void vcl::vertexColorsFromRange (MeshType &mesh, R &&colors, Color::Format colorFormat)
 Sets the vertex colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<MeshConcept MeshType, Range R>
void vcl::vertexMaterialIndicesFromRange (MeshType &mesh, R &&materialIndices)
 Sets the vertex material indices of the given input mesh from the input material indices range (that could be anything that satisfies the Range concept: e.g. std::vector<uint>, std::array<uint, N>, Eigen::VectorXi, etc.).
 
template<MeshConcept MeshType, MatrixConcept VNMatrix>
void vcl::vertexNormalsFromMatrix (MeshType &mesh, const VNMatrix &vertexNormals)
 Sets the vertex normals of the given input mesh from the input vertex normals matrix.
 
template<MeshConcept MeshType, MatrixConcept VMatrix>
void vcl::vertexPositionsFromMatrix (MeshType &mesh, const VMatrix &vertices, bool clearBeforeSet=true)
 Sets the vertex positions of the given input mesh from the input vertex matrix.
 
template<MeshConcept MeshType, Range R>
void vcl::vertexQualityFromRange (MeshType &mesh, R &&quality)
 Sets the vertex quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).
 
template<MeshConcept MeshType, Range R>
void vcl::vertexSelectionFromRange (MeshType &mesh, R &&selection)
 Sets the vertex selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).
 
template<MeshConcept MeshType, MatrixConcept VTMatrix>
void vcl::vertexTexCoordsFromMatrix (MeshType &mesh, const VTMatrix &vertexTexCoords)
 Sets the vertex texcoords of the given input mesh from the input vertex texcoords matrix.
 

Detailed Description

List Import Mesh from Matrix algorithms.

They allow to import mesh data from matrices.

Function Documentation

◆ edgeColorsFromMatrix()

template<EdgeMeshConcept MeshType, MatrixConcept ECMatrix>
void vcl::edgeColorsFromMatrix ( MeshType &  mesh,
const ECMatrix edgeColors 
)

Sets the edge colors of the given input mesh from the input edge colors matrix.

The number of rows of the input matrix must be equal to the number of edges of the mesh, otherwise an exception is thrown.

The input matrix can have 3 or 4 columns. If it has 3 columns, the alpha channel is set to 255 (1.0f).

The input matrix can have integral or floating point scalar type. If it has integral scalar type, the color components are expected to be in range [0, 255]. If it has floating point scalar type, the color components are expected to be in range [0.0f, 1.0f].

The function enables the per-face color component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
ECMatrixthe type of the input edge colors matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input edge colors.
[in]edgeColorsa #E*3 or #E*4 matrix containing the colors of the edges of the mesh.

◆ edgeColorsFromRange()

template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeColorsFromRange ( MeshType &  mesh,
R &&  colors,
Color::Format  colorFormat 
)

Sets the edge colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

Each color of the input range is interpeted as a packed 32-bit unsigned integer in the given colorFormat.

The number of elements of the input range must be equal to the number of edges of the mesh, otherwise an exception is thrown.

The function enables the per-edge quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input edge color.
[in]colorsthe input edge color range.
[in]colorFormatthe format used to pack the color in a single 32 bit value.

◆ edgeIndicesFromMatrix()

template<EdgeMeshConcept MeshType, MatrixConcept EMatrix>
void vcl::edgeIndicesFromMatrix ( MeshType &  mesh,
const EMatrix edges,
bool  clearBeforeSet = true 
)

Sets the edge indices of the given input mesh from the input edge matrix.

If the argument clearBeforeSet is set to true (default), the function clears the edge container of the mesh and then adds a number of edges that depends on the number of rows of the input edge matrix. In this scenario, all the old edges with their components stored in the mesh before calling this function are lost.

If the argument clearBeforeSet is set to false, the function checks that the number of rows of the input edge matrix is equal to the number of edges of the mesh. If this is not the case, an exception is thrown. Then, the function sets the indices of the edges of the mesh from the input edge matrix. In this scenario, all the components (except the indices) of the edges stored in the mesh before calling this function are preserved.

All the other containers of the mesh are left as they are. Pointers to edges stored in the other containers of the mesh are still valid only if the number of edges is not changed (same allocation policy of the std::vector).

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
EMatrixthe type of the input edge matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input edges.
[in]edgesa #E*2 matrix containing the indices of the vertices of the edges of the mesh.
[in]clearBeforeSetif true, the function clears the container of the edges of the mesh before adding the edges from the input matrix. If false, the function sets the indices in the input matrix to the edges of the mesh, leaving all the other components untouched.

◆ edgeNormalsFromMatrix()

template<EdgeMeshConcept MeshType, MatrixConcept ENMatrix>
void vcl::edgeNormalsFromMatrix ( MeshType &  mesh,
const ENMatrix edgeNormals 
)

Sets the edge normals of the given input mesh from the input edge normals matrix.

The number of rows of the input matrix must be equal to the number of edges of the mesh, otherwise an exception is thrown.

The function enables the per-edge normal component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
ENMatrixthe type of the input edge normals matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input edge normals.
[in]edgeNormalsa #E*3 matrix containing the normals of the edges of the mesh.

◆ edgeQualityFromRange()

template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeQualityFromRange ( MeshType &  mesh,
R &&  quality 
)

Sets the edge quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

The number of elements of the input range must be equal to the number of edges of the mesh, otherwise an exception is thrown.

The function enables the per-edge quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input edge quality.
[in]qualitythe input edge quality range.

◆ edgeSelectionFromRange()

template<EdgeMeshConcept MeshType, Range R>
void vcl::edgeSelectionFromRange ( MeshType &  mesh,
R &&  selection 
)

Sets the edge selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of edges of the mesh, otherwise an exception is thrown.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the EdgeMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input edge selection.
[in]selectionthe input edge selection range.

◆ elementColorsFromMatrix()

template<uint ELEM_ID, MeshConcept MeshType, MatrixConcept CMatrix>
void vcl::elementColorsFromMatrix ( MeshType &  mesh,
const CMatrix colors 
)

Sets the element identified by ELEM_ID colors of the given input mesh from the input colors matrix.

The number of rows of the input matrix must be equal to the number of elements of the mesh, otherwise an exception is thrown.

The input matrix can have 3 or 4 columns. If it has 3 columns, the alpha channel is set to 255 (1.0f).

The input matrix can have integral or floating point scalar type. If it has integral scalar type, the color components are expected to be in range [0, 255]. If it has floating point scalar type, the color components are expected to be in range [0.0f, 1.0f].

The function enables the per-element color component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
CMatrixthe type of the input colors matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input colors.
[in]colorsa #V*3 or #V*4 matrix containing the colors of the elements of the mesh.

◆ elementColorsFromRange()

template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementColorsFromRange ( MeshType &  mesh,
R &&  colors,
Color::Format  colorFormat 
)

Sets the element identified by ELEM_ID colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

Each color of the input range is interpeted as a packed 32-bit unsigned integer in the given colorFormat.

The number of elements of the input range must be equal to the number of ELEM_ID elements of the mesh, otherwise an exception is thrown.

The function enables the per-element quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input element color.
[in]colorsthe input element color range.
[in]colorFormatthe format used to pack the color in a single 32 bit value.

◆ elementNormalsFromMatrix()

template<uint ELEM_ID, MeshConcept MeshType, MatrixConcept NMatrix>
void vcl::elementNormalsFromMatrix ( MeshType &  mesh,
const NMatrix normals 
)

Sets the element identified by ELEM_ID normals of the given input mesh from the input normals matrix.

The number of rows of the input matrix must be equal to the number of ELEM_ID elements of the mesh, otherwise an exception is thrown.

The function enables the per-element normal component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
NMatrixthe type of the input normals matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input element normals.
[in]normalsa #E*3 matrix containing the normals of the elements of the mesh.

◆ elementQualityFromRange()

template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementQualityFromRange ( MeshType &  mesh,
R &&  quality 
)

Sets the element identified by ELEM_ID quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

The number of elements of the input range must be equal to the number of ELEM_ID elements of the mesh, otherwise an exception is thrown.

The function enables the per-element quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input element quality.
[in]qualitythe input element quality range.

◆ elementSelectionFromRange()

template<uint ELEM_ID, MeshConcept MeshType, Range R>
void vcl::elementSelectionFromRange ( MeshType &  mesh,
R &&  selection 
)

Sets the element identified by ELEM_ID selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of ELEM_ID elements of the mesh, otherwise an exception is thrown.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input element selection.
[in]selectionthe input element selection range.

◆ faceColorsFromMatrix()

template<FaceMeshConcept MeshType, MatrixConcept FCMatrix>
void vcl::faceColorsFromMatrix ( MeshType &  mesh,
const FCMatrix faceColors 
)

Sets the face colors of the given input mesh from the input face colors matrix.

The number of rows of the input matrix must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The input matrix can have 3 or 4 columns. If it has 3 columns, the alpha channel is set to 255 (1.0f).

The input matrix can have integral or floating point scalar type. If it has integral scalar type, the color components are expected to be in range [0, 255]. If it has floating point scalar type, the color components are expected to be in range [0.0f, 1.0f].

The function enables the per-face color component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
FCMatrixthe type of the input face colors matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input face colors.
[in]faceColorsa #F*3 or #F*4 matrix containing the colors of the faces of the mesh.

◆ faceColorsFromRange()

template<FaceMeshConcept MeshType, Range R>
void vcl::faceColorsFromRange ( MeshType &  mesh,
R &&  colors,
Color::Format  colorFormat 
)

Sets the face colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

Each color of the input range is interpeted as a packed 32-bit unsigned integer in the given colorFormat.

The number of elements of the input range must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The function enables the per-face quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input face color.
[in]colorsthe input face color range.
[in]colorFormatthe format used to pack the color in a single 32 bit value.

◆ faceIndicesFromMatrix()

template<FaceMeshConcept MeshType, MatrixConcept FMatrix>
void vcl::faceIndicesFromMatrix ( MeshType &  mesh,
const FMatrix faces,
bool  clearBeforeSet = true 
)

Sets the face indices of the given input mesh from the input face matrix.

If the MeshType is not a polygonal mesh (e.g. a triangle mesh), the number of columns of the input face matrix must be equal to the number of vertices of each face of the mesh (e.g. 3 for triangle meshes, 4 for quad meshes, etc.). If this condition is not satisfied, an exception is thrown.

If the MeshType is a polygonal mesh, the size of each polygonal face is determined by counting the number of valid vertex indices in each row of the input face matrix. Valid vertex indices are non-negative and not equal to UINT_NULL.

If the argument clearBeforeSet is set to true (default), the function clears the face container of the mesh and then adds a number of faces that depends on the number of rows of the input face matrix. In this scenario, all the old faces with their components stored in the mesh before calling this function are lost.

If the argument clearBeforeSet is set to false, the function checks that the number of rows of the input face matrix is equal to the number of faces of the mesh. If this is not the case, an exception is thrown. Then, the function sets the indices of the faces of the mesh from the input face matrix. In this scenario, all the components (except the indices) of the faces stored in the mesh before calling this function are preserved.

All the other containers of the mesh are left as they are. Pointers to faces stored in the other containers of the mesh are still valid only if the number of faces is not changed (same allocation policy of the std::vector).

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
FMatrixthe type of the input face matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input faces.
[in]facesa #F*K matrix containing the indices of the vertices of the faces of the mesh. If the mesh is not a polygonal mesh (e.g. a triangle mesh), K must be equal to the number of vertices of each face of the mesh (e.g. 3 for triangle meshes, 4 for quad meshes, etc.). If this condition is not satisfied, an exception is thrown.
[in]clearBeforeSetif true, the function clears the container of the faces of the mesh before adding the faces from the input matrix. If false, the function sets the indices from the input matrix to the faces of the mesh, leaving all the other components untouched.

◆ faceMaterialIndicesFromRange()

template<FaceMeshConcept MeshType, Range R>
void vcl::faceMaterialIndicesFromRange ( MeshType &  mesh,
R &&  texCoordIndices 
)

Sets the face material indices of the given input mesh from the input material indices range (that could be anything that satisfies the Range concept: e.g. std::vector<uint>, std::array<uint, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The function enables the per-face material index component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input face material indices.
[in]texCoordIndicesthe input face material indices range.

◆ faceNormalsFromMatrix()

template<FaceMeshConcept MeshType, MatrixConcept FNMatrix>
void vcl::faceNormalsFromMatrix ( MeshType &  mesh,
const FNMatrix faceNormals 
)

Sets the face normals of the given input mesh from the input face normals matrix.

The number of rows of the input matrix must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The function enables the per-face normal component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
FNMatrixthe type of the input face normals matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input face normals.
[in]faceNormalsa #F*3 matrix containing the normals of the faces of the mesh.

◆ faceQualityFromRange()

template<FaceMeshConcept MeshType, Range R>
void vcl::faceQualityFromRange ( MeshType &  mesh,
R &&  quality 
)

Sets the face quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

The number of elements of the input range must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The function enables the per-face quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input face quality.
[in]qualitythe input face quality range.

◆ faceSelectionFromRange()

template<FaceMeshConcept MeshType, Range R>
void vcl::faceSelectionFromRange ( MeshType &  mesh,
R &&  selection 
)

Sets the face selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of faces of the mesh, otherwise an exception is thrown.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input face selection.
[in]selectionthe input face selection range.

◆ faceWedgeTexCoordsFromMatrix()

template<FaceMeshConcept MeshType, MatrixConcept FTMatrix>
void vcl::faceWedgeTexCoordsFromMatrix ( MeshType &  mesh,
const FTMatrix faceWedgeTexCoords 
)

Sets the face wedge texcoords of the given input mesh from the input face wedge texcoords matrix.

The number of rows of the input matrix must be equal to the number of faces of the mesh, otherwise an exception is thrown.

The number of columns is expected to be equal to 2 * K, where K is the number of vertices of the largest face of the mesh. If the mesh has fixed face size (e.g. triangle mesh, quad mesh, etc.), K is equal to the number of vertices of each face of the mesh.

The function enables the per-face wedge texcoords component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the FaceMeshConcept.
FTMatrixthe type of the input face wedge texcoords matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input face wedge texcoords.
[in]faceWedgeTexCoordsa #F*(K*2) matrix containing the wedge texcoords of the faces of the mesh.

◆ meshFromMatrices() [1/2]

template<MeshConcept MeshType, MatrixConcept VMatrix, MatrixConcept FMatrix = Eigen::MatrixX3i, MatrixConcept EMatrix = Eigen::MatrixX2i>
MeshType vcl::meshFromMatrices ( const VMatrix vertices,
const FMatrix faces = FMatrix(),
const EMatrix edges = EMatrix() 
)

Creates and returns a new mesh from the input matrices that are given as arguments.

The function accepts several input matrices, that are used only if their number of rows is different from zero. It tries to fill all the data contained in the non-empty input matrices into the Mesh:

  • if a Mesh is not able to store same data, the relative input matrix is ignored. For example, if the Mesh has no faces, the function will ignore the input face matrix, also if that is not empty.
  • if a Mesh is able to store some data and the relative input matrix is not empty, the data will be stored in the Mesh. If the matrix has not the expected size, an exception is thrown.
Exceptions
vcl::WrongSizeExceptionif the sizes of the non-empty input matrices have not the expected sizes.
Template Parameters
MeshTypethe type of the mesh to be created. It must satisfy the MeshConcept.
VMatrixthe type of the input vertex matrix. It must satisfy the MatrixConcept.
FMatrixthe type of the input face matrix. It must satisfy the MatrixConcept.
EMatrixthe type of the input edge matrix. It must satisfy the MatrixConcept.
Parameters
[in]verticesa #V*3 matrix containing the positions of the vertices of the mesh.
[in]facesa #F*K matrix containing the indices of the vertices of the faces of the mesh. If the MeshType has no faces, the function will ignore this matrix. If the mesh is not a polygonal mesh (e.g. a triangle mesh), K must be equal to the number of vertices of each face of the mesh (e.g. 3 for triangle meshes, 4 for quad meshes, etc.). If this condition is not satisfied, an exception is thrown.
[in]edgesa #E*2 matrix containing the indices of the vertices of the edges of the mesh. If the MeshType has no edges, the function will ignore this matrix.
Returns
a new mesh containing the data passed as argument.

◆ meshFromMatrices() [2/2]

template<MeshConcept MeshType, MatrixConcept VMatrix, MatrixConcept FMatrix = Eigen::MatrixX3i, MatrixConcept EMatrix = Eigen::MatrixX2i>
void vcl::meshFromMatrices ( MeshType &  mesh,
const VMatrix vertices,
const FMatrix faces = FMatrix(),
const EMatrix edges = EMatrix() 
)

Sets the given input mesh from the input matrices that are given as arguments.

The function accepts several input matrices, that are used only if their number of rows is different from zero. It tries to fill all the data contained in the non-empty input matrices into the Mesh:

  • if a Mesh is not able to store same data, the relative input matrix is ignored. For example, if the Mesh has no faces, the function will ignore the input face matrix, also if that is not empty.
  • if a Mesh is able to store some data and the relative input matrix is not empty, the data will be stored in the Mesh. If the matrix has not the expected size, an exception is thrown.

The mesh is cleared and all the optional components are disabled before adding the data from the input matrices.

Note
If the Mesh is not able to store some data from the matrices, that data will be ignored. For example, if the Mesh has no faces, the function will ignore the input face matrix, also if that is not empty.
Exceptions
vcl::WrongSizeExceptionif the sizes of the non-empty input matrices have not the expected sizes.
Template Parameters
MeshTypethe type of the mesh to be created. It must satisfy the MeshConcept.
VMatrixthe type of the input vertex matrix. It must satisfy the MatrixConcept.
FMatrixthe type of the input face matrix. It must satisfy the MatrixConcept.
EMatrixthe type of the input edge matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import all the input data from the matrices.
[in]verticesa #V*3 matrix containing the positions of the vertices of the mesh.
[in]facesa #F*K matrix containing the indices of the vertices of the faces of the mesh. If the MeshType has no faces, the function will ignore this matrix. If the mesh is not a polygonal mesh (e.g. a triangle mesh), K must be equal to the number of vertices of each face of the mesh (e.g. 3 for triangle meshes, 4 for quad meshes, etc.). If this condition is not satisfied, an exception is thrown.
[in]edgesa #E*2 matrix containing the indices of the vertices of the edges of the mesh. If the MeshType has no edges, the function will ignore this matrix.

◆ vertexColorsFromMatrix()

template<MeshConcept MeshType, MatrixConcept VCMatrix>
void vcl::vertexColorsFromMatrix ( MeshType &  mesh,
const VCMatrix vertexColors 
)

Sets the vertex colors of the given input mesh from the input vertex colors matrix.

The number of rows of the input matrix must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The input matrix can have 3 or 4 columns. If it has 3 columns, the alpha channel is set to 255 (1.0f).

The input matrix can have integral or floating point scalar type. If it has integral scalar type, the color components are expected to be in range [0, 255]. If it has floating point scalar type, the color components are expected to be in range [0.0f, 1.0f].

The function enables the per-vertex color component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
VCMatrixthe type of the input vertex colors matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input vertex colors.
[in]vertexColorsa #V*3 or #V*4 matrix containing the colors of the vertices of the mesh.

◆ vertexColorsFromRange()

template<MeshConcept MeshType, Range R>
void vcl::vertexColorsFromRange ( MeshType &  mesh,
R &&  colors,
Color::Format  colorFormat 
)

Sets the vertex colors of the given input mesh from the input color range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

Each color of the input range is interpeted as a packed 32-bit unsigned integer in the given colorFormat.

The number of elements of the input range must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The function enables the per-vertex quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input vertex color.
[in]colorsthe input vertex color range.
[in]colorFormatthe format used to pack the color in a single 32 bit value.

◆ vertexMaterialIndicesFromRange()

template<MeshConcept MeshType, Range R>
void vcl::vertexMaterialIndicesFromRange ( MeshType &  mesh,
R &&  materialIndices 
)

Sets the vertex material indices of the given input mesh from the input material indices range (that could be anything that satisfies the Range concept: e.g. std::vector<uint>, std::array<uint, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The function enables the per-vertex material indices component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input vertex material indices.
[in]materialIndicesthe input vertex material indices range.

◆ vertexNormalsFromMatrix()

template<MeshConcept MeshType, MatrixConcept VNMatrix>
void vcl::vertexNormalsFromMatrix ( MeshType &  mesh,
const VNMatrix vertexNormals 
)

Sets the vertex normals of the given input mesh from the input vertex normals matrix.

The number of rows of the input matrix must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The function enables the per-vertex normal component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
VNMatrixthe type of the input vertex normals matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input vertex normals.
[in]vertexNormalsa #V*3 matrix containing the normals of the vertices of the mesh.

◆ vertexPositionsFromMatrix()

template<MeshConcept MeshType, MatrixConcept VMatrix>
void vcl::vertexPositionsFromMatrix ( MeshType &  mesh,
const VMatrix vertices,
bool  clearBeforeSet = true 
)

Sets the vertex positions of the given input mesh from the input vertex matrix.

If the argument clearBeforeSet is set to true (default), the function clears the vertex container of the mesh and then adds a number of vertices that depends on the number of rows of the input vertex matrix. In this scenario, all the old vertices with their components stored in the mesh before calling this function are lost.

If the argument clearBeforeSet is set to false, the function checks that the number of rows of the input vertex matrix is equal to the number of vertices of the mesh. If this is not the case, an exception is thrown. Then, the function sets the positions of the vertices of the mesh from the input vertex matrix. In this scenario, all the components (except the positions) of the vertices stored in the mesh before calling this function are preserved.

All the other containers of the mesh are left as they are. Pointers to vertices stored in the other containers of the mesh are still valid only if the number of vertices is not changed (same allocation policy of the std::vector).

Exceptions
vcl::WrongSizeExceptionif the sizes of the input matrix are not valid (e.g. columns != 3 or rows != mesh.vertexNumber()).
Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
VMatrixthe type of the input vertex matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input vertices.
[in]verticesa #V*3 matrix containing the positions of the vertices of the mesh.
[in]clearBeforeSetif true, the function clears the container of the vertices of the mesh before adding the vertices from the input matrix. If false, the function sets the positions in the input matrix to the vertices of the mesh, leaving all the other components untouched.

◆ vertexQualityFromRange()

template<MeshConcept MeshType, Range R>
void vcl::vertexQualityFromRange ( MeshType &  mesh,
R &&  quality 
)

Sets the vertex quality of the given input mesh from the input quality range (that could be anything that satisfies the Range concept: e.g. std::vector<double>, std::array<double, N>, Eigen::VectorXd, etc.).

The number of elements of the input range must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The function enables the per-vertex quality component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input vertex quality.
[in]qualitythe input vertex quality range.

◆ vertexSelectionFromRange()

template<MeshConcept MeshType, Range R>
void vcl::vertexSelectionFromRange ( MeshType &  mesh,
R &&  selection 
)

Sets the vertex selection of the given input mesh from the input selection range (that could be anything that satisfies the Range concept: e.g. std::vector<bool>, std::array<bool, N>, Eigen::VectorXi, etc.).

The number of elements of the input range must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
Rthe type of the input range. It must satisfy the Range concept.
Parameters
[in/out]mesh: the mesh on which import the input vertex selection.
[in]selectionthe input vertex selection range.

◆ vertexTexCoordsFromMatrix()

template<MeshConcept MeshType, MatrixConcept VTMatrix>
void vcl::vertexTexCoordsFromMatrix ( MeshType &  mesh,
const VTMatrix vertexTexCoords 
)

Sets the vertex texcoords of the given input mesh from the input vertex texcoords matrix.

The number of rows of the input matrix must be equal to the number of vertices of the mesh, otherwise an exception is thrown.

The function enables the per-vertex texcoords component if it is not already enabled.

Template Parameters
MeshTypethe type of the mesh to be filled. It must satisfy the MeshConcept.
VTMatrixthe type of the input vertex texcoords matrix. It must satisfy the MatrixConcept.
Parameters
[in/out]mesh: the mesh on which import the input vertex texcoords.
[in]vertexTexCoordsa #V*2 matrix containing the texcoords of the vertices of the mesh.