23#ifndef VCL_ALGORITHMS_MESH_IMPORT_EXPORT_IMPORT_MATRIX_H
24#define VCL_ALGORITHMS_MESH_IMPORT_EXPORT_IMPORT_MATRIX_H
26#include "import_buffer.h"
28#include <vclib/mesh.h>
29#include <vclib/space/core.h>
87 MatrixConcept VMatrix,
88 MatrixConcept FMatrix = Eigen::MatrixX3i,
89 MatrixConcept EMatrix = Eigen::MatrixX2i>
152 MeshConcept MeshType,
153 MatrixConcept VMatrix,
154 MatrixConcept FMatrix = Eigen::MatrixX3i,
155 MatrixConcept EMatrix = Eigen::MatrixX2i>
163 mesh.disableAllOptionalComponents();
168 if (faces.rows() > 0)
173 if (edges.rows() > 0)
219template<MeshConcept MeshType, MatrixConcept VMatrix>
225 if (vertices.cols() != 3)
283template<FaceMeshConcept MeshType, MatrixConcept FMatrix>
331template<EdgeMeshConcept MeshType, MatrixConcept EMatrix>
337 if (edges.cols() != 2)
363template<u
int ELEM_ID, MeshConcept MeshType, Range R>
368 "The input selection range must have the same number of elements "
369 "as the number of " +
372 auto s = selection.begin();
395template<MeshConcept MeshType, Range R>
417template<FaceMeshConcept MeshType, Range R>
439template<EdgeMeshConcept MeshType, Range R>
465template<u
int ELEM_ID, MeshConcept MeshType, MatrixConcept NMatrix>
470 if (normals.cols() != 3)
473 " normal matrix must have 3 columns");
477 "The input normal matrix must have the same number of rows as the "
504template<MeshConcept MeshType, MatrixConcept VNMatrix>
530template<FaceMeshConcept MeshType, MatrixConcept FNMatrix>
556template<EdgeMeshConcept MeshType, MatrixConcept ENMatrix>
590template<u
int ELEM_ID, MeshConcept MeshType, MatrixConcept CMatrix>
596 Color::Representation::INT_0_255 :
597 Color::Representation::FLOAT_0_1;
601 "The input colors matrix must have the same number of rows as the "
634template<u
int ELEM_ID, MeshConcept MeshType, Range R>
642 "The input color range must have the same number of elements "
643 "as the number of " +
649 auto c = colors.begin();
684template<MeshConcept MeshType, MatrixConcept VCMatrix>
714template<MeshConcept MeshType, Range R>
751template<FaceMeshConcept MeshType, MatrixConcept FCMatrix>
781template<FaceMeshConcept MeshType, Range R>
815template<EdgeMeshConcept MeshType, MatrixConcept ECMatrix>
845template<EdgeMeshConcept MeshType, Range R>
871template<u
int ELEM_ID, MeshConcept MeshType, Range R>
876 "The input quality range must have the same number of elements "
877 "as the number of " +
883 auto q = quality.begin();
909template<MeshConcept MeshType, Range R>
934template<FaceMeshConcept MeshType, Range R>
959template<EdgeMeshConcept MeshType, Range R>
985template<MeshConcept MeshType, MatrixConcept VTMatrix>
992 "The input vertex texcoords matrix must have 2 columns");
996 "The input vertex texcoords must have the same number of rows as "
997 "the number of vertices in the mesh");
1023template<MeshConcept MeshType, Range R>
1028 "The input quality range must have the same number of elements "
1029 "as the number of vertices in the mesh");
1031 enableIfPerVertexMaterialIndexOptional(mesh);
1032 requirePerVertexMaterialIndex(mesh);
1035 for (
auto& v : mesh.vertices()) {
1036 v.materialIndex() = *
tt;
1066template<FaceMeshConcept MeshType, MatrixConcept FTMatrix>
1075 "The input face wedge texcoords must have the same number of rows "
1076 "as the number of faces in the mesh");
1103template<FaceMeshConcept MeshType, Range R>
1108 "The input quality range must have the same number of elements "
1109 "as the number of faces in the mesh");
1115 for (
auto& f : mesh.faces()) {
1116 f.materialIndex() = *
tt;
A class representing a box in N-dimensional space.
Definition box.h:46
The Color class represents a 32 bit color.
Definition color.h:48
Format
Color format enumeration.
Definition color.h:77
Representation
Color representation enumeration.
Definition color.h:64
Exception thrown when the size (generally of a container) is not the expected one.
Definition exceptions.h:45
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:1064
HasFaces concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition face_container.h:1429
MatrixStorageType
A simple type that enumerates the main storage types for matrices (row or column major).
Definition base.h:88
void requirePerFaceMaterialIndex(const MeshType &m)
This function asserts that a Mesh has a FaceContainer, the Face has a MaterialIndex Component,...
Definition face_requirements.h:1143
bool enableIfPerFaceMaterialIndexOptional(MeshType &m)
If the input mesh has a FaceContainer, and the Face Element has a MaterialIndex Component,...
Definition face_requirements.h:633
void vertexPositionsFromBuffer(MeshType &mesh, const auto *buffer, uint vertexNumber, bool clearBeforeSet=true, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Sets the vertex positions of the given input mesh from the input buffer, that is expected to be a con...
Definition import_buffer.h:93
void faceIndicesFromBuffer(MeshType &mesh, const auto *buffer, uint faceNumber, uint faceSize=3, bool clearBeforeSet=true, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Sets the face indices of the given input mesh from the input face buffer, that is expected to be a co...
Definition import_buffer.h:190
void faceWedgeTexCoordsFromBuffer(MeshType &mesh, const auto *buffer, uint largestFaceSize=3, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Sets the face wedge texcoords of the given input mesh from the input buffer, that is expected to be a...
Definition import_buffer.h:1184
void vertexTexCoordsFromBuffer(MeshType &mesh, const auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Sets the vertex texcoords of the given input mesh from the input buffer, that is expected to be a con...
Definition import_buffer.h:1093
void edgeIndicesFromBuffer(MeshType &mesh, const auto *buffer, uint edgeNumber, bool clearBeforeSet=true, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Sets the edge indices of the given input mesh from the input edge buffer, that is expected to be a co...
Definition import_buffer.h:309
void 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 ...
Definition import_matrix.h:846
void 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 tha...
Definition import_matrix.h:715
void faceColorsFromMatrix(MeshType &mesh, const FCMatrix &faceColors)
Sets the face colors of the given input mesh from the input face colors matrix.
Definition import_matrix.h:752
void elementNormalsFromMatrix(MeshType &mesh, const NMatrix &normals)
Sets the element identified by ELEM_ID normals of the given input mesh from the input normals matrix.
Definition import_matrix.h:466
MeshType 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.
Definition import_matrix.h:90
void vertexMaterialIndicesFromRange(MeshType &mesh, R &&materialIndices)
Sets the vertex material indices of the given input mesh from the input material indices range (that ...
Definition import_matrix.h:1024
void elementSelectionFromRange(MeshType &mesh, R &&selection)
Sets the element identified by ELEM_ID selection of the given input mesh from the input selection ran...
Definition import_matrix.h:364
void edgeIndicesFromMatrix(MeshType &mesh, const EMatrix &edges, bool clearBeforeSet=true)
Sets the edge indices of the given input mesh from the input edge matrix.
Definition import_matrix.h:332
void faceMaterialIndicesFromRange(MeshType &mesh, R &&texCoordIndices)
Sets the face material indices of the given input mesh from the input material indices range (that co...
Definition import_matrix.h:1104
void vertexTexCoordsFromMatrix(MeshType &mesh, const VTMatrix &vertexTexCoords)
Sets the vertex texcoords of the given input mesh from the input vertex texcoords matrix.
Definition import_matrix.h:986
void faceQualityFromRange(MeshType &mesh, R &&quality)
Sets the face quality of the given input mesh from the input quality range (that could be anything th...
Definition import_matrix.h:935
void edgeQualityFromRange(MeshType &mesh, R &&quality)
Sets the edge quality of the given input mesh from the input quality range (that could be anything th...
Definition import_matrix.h:960
void edgeSelectionFromRange(MeshType &mesh, R &&selection)
Sets the edge selection of the given input mesh from the input selection range (that could be anythin...
Definition import_matrix.h:440
void 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 (tha...
Definition import_matrix.h:635
void edgeColorsFromMatrix(MeshType &mesh, const ECMatrix &edgeColors)
Sets the edge colors of the given input mesh from the input edge colors matrix.
Definition import_matrix.h:816
void faceWedgeTexCoordsFromMatrix(MeshType &mesh, const FTMatrix &faceWedgeTexCoords)
Sets the face wedge texcoords of the given input mesh from the input face wedge texcoords matrix.
Definition import_matrix.h:1067
void vertexPositionsFromMatrix(MeshType &mesh, const VMatrix &vertices, bool clearBeforeSet=true)
Sets the vertex positions of the given input mesh from the input vertex matrix.
Definition import_matrix.h:220
void 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 ...
Definition import_matrix.h:782
void faceSelectionFromRange(MeshType &mesh, R &&selection)
Sets the face selection of the given input mesh from the input selection range (that could be anythin...
Definition import_matrix.h:418
void vertexNormalsFromMatrix(MeshType &mesh, const VNMatrix &vertexNormals)
Sets the vertex normals of the given input mesh from the input vertex normals matrix.
Definition import_matrix.h:505
void edgeNormalsFromMatrix(MeshType &mesh, const ENMatrix &edgeNormals)
Sets the edge normals of the given input mesh from the input edge normals matrix.
Definition import_matrix.h:557
void elementQualityFromRange(MeshType &mesh, R &&quality)
Sets the element identified by ELEM_ID quality of the given input mesh from the input quality range (...
Definition import_matrix.h:872
void vertexSelectionFromRange(MeshType &mesh, R &&selection)
Sets the vertex selection of the given input mesh from the input selection range (that could be anyth...
Definition import_matrix.h:396
void elementColorsFromMatrix(MeshType &mesh, const CMatrix &colors)
Sets the element identified by ELEM_ID colors of the given input mesh from the input colors matrix.
Definition import_matrix.h:591
void vertexColorsFromMatrix(MeshType &mesh, const VCMatrix &vertexColors)
Sets the vertex colors of the given input mesh from the input vertex colors matrix.
Definition import_matrix.h:685
void vertexQualityFromRange(MeshType &mesh, R &&quality)
Sets the vertex quality of the given input mesh from the input quality range (that could be anything ...
Definition import_matrix.h:910
void faceIndicesFromMatrix(MeshType &mesh, const FMatrix &faces, bool clearBeforeSet=true)
Sets the face indices of the given input mesh from the input face matrix.
Definition import_matrix.h:284
void faceNormalsFromMatrix(MeshType &mesh, const FNMatrix &faceNormals)
Sets the face normals of the given input mesh from the input face normals matrix.
Definition import_matrix.h:531