18 #include <unordered_map>
19 #include <unordered_set>
48 explicit ccMesh(
const std::vector<Eigen::Vector3d>& vertices,
49 const std::vector<Eigen::Vector3i>& triangles);
69 bool CreateInternalCloud();
89 ccMesh* partialClone(
const std::vector<unsigned>& triangleIndices,
90 int* warnings =
nullptr)
const;
105 static_cast<unsigned int>(vidx1),
106 static_cast<unsigned int>(vidx2));
114 bool updateNormals =
false,
116 unsigned char dim = 2);
128 bool merge(
const ccMesh* mesh,
bool createSubMesh);
144 return m_associatedCloud;
159 bool interpolateColorIfNoTexture)
override;
161 unsigned char vertIndex,
163 bool returnColorIfNoTexture)
override;
167 void forEach(genericTriangleAction action)
override;
171 unsigned triangleIndex)
override;
174 unsigned triangleIndex)
override;
182 double C[3])
const override;
184 unsigned int getVerticeSize()
const;
186 Eigen::Vector3d getVertice(
size_t index)
const;
187 void setVertice(
size_t index,
const Eigen::Vector3d& vertice);
188 void addVertice(
const Eigen::Vector3d& vertice);
189 std::vector<Eigen::Vector3d> getEigenVertices()
const;
190 void addEigenVertices(
const std::vector<Eigen::Vector3d>& vertices);
191 void setEigenVertices(
const std::vector<Eigen::Vector3d>& vertices);
193 Eigen::Vector3d getVertexNormal(
size_t index)
const;
194 void setVertexNormal(
size_t index,
const Eigen::Vector3d&
normal);
195 void addVertexNormal(
const Eigen::Vector3d&
normal);
196 std::vector<Eigen::Vector3d> getVertexNormals()
const;
197 void addVertexNormals(
const std::vector<Eigen::Vector3d>&
normals);
198 void setVertexNormals(
const std::vector<Eigen::Vector3d>&
normals);
200 Eigen::Vector3d getVertexColor(
size_t index)
const;
201 void setVertexColor(
size_t index,
const Eigen::Vector3d&
color);
202 void addVertexColor(
const Eigen::Vector3d&
color);
203 std::vector<Eigen::Vector3d> getVertexColors()
const;
205 void addVertexColors(
const std::vector<Eigen::Vector3d>&
colors);
206 void setVertexColors(
const std::vector<Eigen::Vector3d>&
colors);
210 std::vector<CCVector3>& getVerticesPtr();
211 const std::vector<CCVector3>& getVertices()
const;
213 virtual unsigned size()
const override;
224 unsigned triangleIndex)
const;
229 bool HasVertexNormals()
const;
243 void shiftTriangleIndexes(
unsigned shift);
248 void flipTriangles();
258 void addTriangle(
unsigned i1,
unsigned i2,
unsigned i3);
261 addTriangle(
static_cast<unsigned>(index[0]),
262 static_cast<unsigned>(index[1]),
263 static_cast<unsigned>(index[2]));
265 inline void addTriangles(
const std::vector<Eigen::Vector3i>& triangles) {
266 for (
auto& tri : triangles) {
272 void setTriangles(
const std::vector<Eigen::Vector3i>& triangles);
274 std::vector<Eigen::Vector3i> getTriangles()
const;
280 return m_triVertIndexes;
287 bool reserve(std::size_t n);
288 bool reserveAssociatedCloud(std::size_t n,
289 bool init_color =
false,
290 bool init_normal =
false);
298 bool resize(
size_t n);
299 bool resizeAssociatedCloud(std::size_t n);
305 void shrinkVertexToFit();
318 int& i3)
const override;
326 double Nc[3])
const override;
330 Eigen::Vector3d& Nc)
const override;
332 std::vector<CCVector3*> getTriangleNormalsPtr()
const;
333 Eigen::Vector3d getTriangleNorm(
size_t index)
const;
334 bool setTriangleNorm(
size_t index,
const Eigen::Vector3d& triangle_normal);
335 bool setTriangleNormalIndexes(
size_t triangleIndex,
338 bool addTriangleNorm(
const CCVector3& N);
339 bool addTriangleNorm(
const Eigen::Vector3d& N);
340 std::vector<Eigen::Vector3d> getTriangleNorms()
const;
341 bool setTriangleNorms(
const std::vector<Eigen::Vector3d>& triangle_normals);
342 bool addTriangleNorms(
const std::vector<Eigen::Vector3d>& triangle_normals);
350 bool autoReleaseOldTable =
true);
366 bool arePerTriangleNormalsEnabled()
const;
378 bool reservePerTriangleNormalIndexes();
387 void addTriangleNormalIndexes(
int i1,
int i2,
int i3);
395 void setTriangleNormalIndexes(
unsigned triangleIndex,
401 void removePerTriangleNormalIndexes();
404 void invertPerTriangleNormals();
418 bool convertMaterialsToVertexColors();
422 return m_triMtlIndexes && m_triMtlIndexes->isAllocated();
435 bool reservePerTriangleMtlIndexes();
438 void removePerTriangleMtlIndexes();
444 void addTriangleMtlIndex(
int mtlIndex);
451 bool autoReleaseOldTable =
true);
456 return m_triMtlIndexes;
464 void setTriangleMtlIndex(
unsigned triangleIndex,
int mtlIndex);
468 bool autoReleaseOldMaterialSet =
true);
485 return m_texCoordIndexes && m_texCoordIndexes->isAllocated();
490 int& i3)
const override;
494 bool autoReleaseOldTable =
true);
506 bool reservePerTriangleTexCoordIndexes();
509 void removePerTriangleTexCoordIndexes();
518 void addTriangleTexCoordIndexes(
int i1,
int i2,
int i3);
526 void setTriangleTexCoordIndexes(
unsigned triangleIndex,
538 bool computePerVertexNormals();
541 bool computePerTriangleNormals();
548 bool laplacianSmooth(
549 unsigned nbIteration = 100,
569 bool processScalarField(MESH_SCALAR_FIELD_PROCESS process);
595 ccMesh* createNewMeshFromSelection(
596 bool removeSelectedTriangles,
597 std::vector<int>* newIndexesOfRemainingTriangles =
nullptr,
598 bool withChildEntities =
false);
604 void swapTriangles(
unsigned index1,
unsigned index2);
606 void removeTriangles(
size_t index);
609 void transformTriNormals(
const ccGLMatrix& trans);
612 static const unsigned char DefaultMergeDulicateVerticesLevel = 10;
615 bool mergeDuplicatedVertices(
616 unsigned char octreeLevel = DefaultMergeDulicateVerticesLevel,
617 QWidget* parentWidget =
nullptr);
672 return {r, g, b, 1.f};
675 float r()
const {
return f4[0]; }
676 float g()
const {
return f4[1]; }
677 float b()
const {
return f4[2]; }
678 float a()
const {
return f4[3]; }
682 float baseMetallic = 0.f;
683 float baseRoughness = 1.f;
684 float baseReflectance = 0.5f;
685 float baseClearCoat = 0.f;
686 float baseClearCoatRoughness = 0.f;
687 float baseAnisotropy = 0.f;
689 std::shared_ptr<cloudViewer::geometry::Image>
albedo;
690 std::shared_ptr<cloudViewer::geometry::Image>
normalMap;
692 std::shared_ptr<cloudViewer::geometry::Image>
metallic;
693 std::shared_ptr<cloudViewer::geometry::Image>
roughness;
695 std::shared_ptr<cloudViewer::geometry::Image>
clearCoat;
700 std::unordered_map<std::string, cloudViewer::geometry::Image>
713 return getVerticeSize() > 0 &&
714 adjacency_list_.size() == getVerticeSize();
727 bool is_all_texture_valid = std::accumulate(
728 textures_.begin(), textures_.end(),
true,
730 return a && !b.IsEmpty();
732 return !textures_.empty() && is_all_texture_valid;
735 inline virtual bool IsEmpty()
const override {
739 virtual Eigen::Vector3d
GetMinBound()
const override;
740 virtual Eigen::Vector3d
GetMaxBound()
const override;
741 virtual Eigen::Vector3d
GetCenter()
const override;
744 virtual ccMesh&
Transform(
const Eigen::Matrix4d& transformation)
override;
746 bool relative =
true)
override;
748 const Eigen::Vector3d& center)
override;
750 const Eigen::Vector3d& center)
override;
755 ccMesh& PaintUniformColor(
const Eigen::Vector3d&
color);
757 std::tuple<std::shared_ptr<ccMesh>, std::vector<size_t>> ComputeConvexHull()
771 ComputeEdgeWeightsCot(
772 const std::unordered_map<
777 double min_weight = std::numeric_limits<double>::lowest())
const;
781 ccMesh& ComputeTriangleNormals(
bool normalized =
true);
785 ccMesh& ComputeVertexNormals(
bool normalized =
true);
789 ccMesh& NormalizeNormals();
792 ccMesh& ComputeAdjacencyList();
796 ccMesh& RemoveDuplicatedVertices();
801 ccMesh& RemoveDuplicatedTriangles();
805 ccMesh& RemoveUnreferencedVertices();
811 ccMesh& RemoveDegenerateTriangles();
817 ccMesh& RemoveNonManifoldEdges();
825 ccMesh& MergeCloseVertices(
double eps);
836 std::shared_ptr<ccMesh> FilterSharpen(
837 int number_of_iterations,
839 FilterScope scope = FilterScope::All)
const;
849 std::shared_ptr<ccMesh> FilterSmoothSimple(
850 int number_of_iterations,
851 FilterScope scope = FilterScope::All)
const;
863 std::shared_ptr<ccMesh> FilterSmoothLaplacian(
864 int number_of_iterations,
866 FilterScope scope = FilterScope::All)
const;
878 std::shared_ptr<ccMesh> FilterSmoothTaubin(
879 int number_of_iterations,
882 FilterScope scope = FilterScope::All)
const;
887 int EulerPoincareCharacteristic()
const;
892 std::vector<Eigen::Vector2i> GetNonManifoldEdges(
893 bool allow_boundary_edges =
true)
const;
899 bool IsEdgeManifold(
bool allow_boundary_edges =
true)
const;
904 std::vector<int> GetNonManifoldVertices()
const;
909 bool IsVertexManifold()
const;
913 std::vector<Eigen::Vector2i> GetSelfIntersectingTriangles()
const;
917 bool IsSelfIntersecting()
const;
921 bool IsBoundingBoxIntersecting(
const ccMesh& other)
const;
925 bool IsIntersecting(
const ccMesh& other)
const;
930 bool IsOrientable()
const;
935 bool IsWatertight()
const;
940 bool OrientTriangles();
954 GetEdgeToVerticesMap()
const;
958 double GetTriangleArea(
size_t triangle_idx)
const;
961 static double ComputeTriangleArea(
const Eigen::Vector3d& p0,
962 const Eigen::Vector3d& p1,
963 const Eigen::Vector3d& p2);
982 double GetSurfaceArea()
const;
986 double GetSurfaceArea(std::vector<double>& triangle_areas)
const;
991 double GetVolume()
const;
996 static Eigen::Vector4d ComputeTrianglePlane(
const Eigen::Vector3d& p0,
997 const Eigen::Vector3d& p1,
998 const Eigen::Vector3d& p2);
1002 Eigen::Vector4d GetTrianglePlane(
size_t triangle_idx)
const;
1006 return Eigen::Vector2i(std::min(vidx0, vidx1), std::max(vidx0, vidx1));
1011 std::shared_ptr<ccPointCloud> SamplePointsUniformlyImpl(
1012 size_t number_of_points,
1013 std::vector<double>& triangle_areas,
1014 double surface_area,
1015 bool use_triangle_normal,
1025 std::shared_ptr<ccPointCloud> SamplePointsUniformly(
1026 size_t number_of_points,
1027 bool use_triangle_normal =
false,
1041 std::shared_ptr<ccPointCloud> SamplePointsPoissonDisk(
1042 size_t number_of_points,
1043 double init_factor = 5,
1044 const std::shared_ptr<ccPointCloud> pcl_init =
nullptr,
1045 bool use_triangle_normal =
false,
1053 std::shared_ptr<ccMesh> SubdivideMidpoint(
int number_of_iterations)
const;
1060 std::shared_ptr<ccMesh> SubdivideLoop(
int number_of_iterations)
const;
1068 std::shared_ptr<ccMesh> SimplifyVertexClustering(
1070 SimplificationContraction contraction =
1071 SimplificationContraction::Average)
const;
1080 std::shared_ptr<ccMesh> SimplifyQuadricDecimation(
1081 int target_number_of_triangles,
1082 double maximum_error = std::numeric_limits<double>::infinity(),
1083 double boundary_weight = 1.0)
const;
1094 std::shared_ptr<ccMesh>
SelectByIndex(
const std::vector<size_t>& indices,
1095 bool cleanup =
true)
const;
1101 std::shared_ptr<ccMesh> Crop(
const ccBBox& bbox)
const;
1115 std::tuple<std::vector<int>, std::vector<size_t>, std::vector<double>>
1116 ClusterConnectedTriangles()
const;
1124 void RemoveTrianglesByIndex(
const std::vector<size_t>& triangle_indices);
1132 void RemoveTrianglesByMask(
const std::vector<bool>& triangle_mask);
1140 void RemoveVerticesByIndex(
const std::vector<size_t>& vertex_indices);
1148 void RemoveVerticesByMask(
const std::vector<bool>& vertex_mask);
1163 std::shared_ptr<ccMesh> DeformAsRigidAsPossible(
1164 const std::vector<int>& constraint_vertex_indices,
1165 const std::vector<Eigen::Vector3d>& constraint_vertex_positions,
1167 DeformAsRigidAsPossibleEnergy energy =
1168 DeformAsRigidAsPossibleEnergy::Spokes,
1169 double smoothed_alpha = 0.01)
const;
1182 static std::shared_ptr<ccMesh> CreateFromPointCloudAlphaShape(
1185 std::shared_ptr<cloudViewer::geometry::TetraMesh> tetra_mesh =
1187 std::vector<size_t>* pt_map =
nullptr);
1201 static std::shared_ptr<ccMesh> CreateFromPointCloudBallPivoting(
1240 static std::tuple<std::shared_ptr<ccMesh>, std::vector<double>>
1245 bool linear_fit =
false,
1246 float point_weight = 2.f,
1247 float samples_per_node = 1.5f,
1248 int boundary_type = 2 ,
1249 int n_threads = -1);
1256 static std::shared_ptr<ccMesh> CreateTetrahedron(
1257 double radius = 1.0,
bool create_uv_map =
false);
1264 static std::shared_ptr<ccMesh> CreateOctahedron(
double radius = 1.0,
1265 bool create_uv_map =
false);
1271 static std::shared_ptr<ccMesh> CreateIcosahedron(
1272 double radius = 1.0,
bool create_uv_map =
false);
1281 bool create_uv_map =
false);
1291 static std::shared_ptr<ccMesh> CreateBox(
1295 bool create_uv_map =
false,
1296 bool map_texture_to_each_face =
false);
1308 static std::shared_ptr<ccMesh> CreateSphere(
double radius = 1.0,
1309 int resolution = 20,
1310 bool create_uv_map =
false);
1323 static std::shared_ptr<ccMesh> CreateCylinder(
double radius = 1.0,
1325 int resolution = 20,
1327 bool create_uv_map =
false);
1339 static std::shared_ptr<ccMesh> CreateCone(
double radius = 1.0,
1341 int resolution = 20,
1343 bool create_uv_map =
false);
1355 static std::shared_ptr<ccMesh> CreateTorus(
double torus_radius = 1.0,
1356 double tube_radius = 0.5,
1357 int radial_resolution = 30,
1358 int tubular_resolution = 20);
1380 static std::shared_ptr<ccMesh> CreateArrow(
double cylinder_radius = 1.0,
1381 double cone_radius = 1.5,
1382 double cylinder_height = 5.0,
1383 double cone_height = 4.0,
1384 int resolution = 20,
1385 int cylinder_split = 4,
1386 int cone_split = 1);
1393 static std::shared_ptr<ccMesh> CreateCoordinateFrame(
1395 const Eigen::Vector3d&
origin = Eigen::Vector3d(0.0, 0.0, 0.0));
1407 static std::shared_ptr<ccMesh> CreateMobius(
int length_split = 70,
1408 int width_split = 15,
1411 double flatness = 1,
1416 void FilterSmoothLaplacianHelper(
1417 std::shared_ptr<ccMesh>& mesh,
1418 const std::vector<CCVector3>& prev_vertices,
1419 const std::vector<CCVector3>& prev_vertex_normals,
1421 const std::vector<std::unordered_set<int>>& adjacency_list,
1425 bool filter_color)
const;
1430 bool toFile_MeOnly(QFile& out,
short dataVersion)
const override;
1435 LoadedIDMap& oldToNewIDMap)
override;
1451 const Tuple3i* triNormIndexes =
nullptr);
1459 bool pushSubdivide(
unsigned indexA,
1466 #define ccMesh_extended_call0(baseName, recursiveName) \
1467 inline virtual void recursiveName() { \
1469 for (Container::iterator it = m_children.begin(); \
1470 it != m_children.end(); ++it) \
1471 if ((*it)->isA(CV_TYPES::SUB_MESH)) \
1472 static_cast<ccGenericMesh*>(*it)->baseName(); \
1476 #define ccMesh_extended_call1(baseName, param1Type, recursiveName) \
1477 inline virtual void recursiveName(param1Type p) { \
1479 for (Container::iterator it = m_children.begin(); \
1480 it != m_children.end(); ++it) \
1481 if ((*it)->isA(CV_TYPES::SUB_MESH)) \
1482 static_cast<ccGenericMesh*>(*it)->baseName(p); \
1505 unsigned m_globalIterator;
float PointCoordinateType
Type of the coordinates of a (N-D) point.
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2)
Array of RGB colors for each point.
Array of compressed 3D normals (single index)
Array of 2D texture coordinates.
Shareable array that can be properly inserted in the DB tree.
virtual bool hasDisplayedScalarField() const
Returns whether an active scalar field is available or not.
virtual bool hasColors() const
Returns whether colors are enabled or not.
virtual bool normalsShown() const
Returns whether normals are shown or not.
virtual bool hasNormals() const
Returns whether normals are enabled or not.
virtual bool hasScalarFields() const
Returns whether one or more scalar fields are instantiated.
Float version of ccGLMatrixTpl.
virtual bool materialsShown() const
Sets whether textures/material should be displayed or not.
virtual bool hasTextures() const =0
Returns whether textures are available for this mesh.
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
virtual void getTriangleNormalIndexes(unsigned triangleIndex, int &i1, int &i2, int &i3) const =0
Returns a triplet of normal indexes for a given triangle (if any)
virtual void getTriangleTexCoordinatesIndexes(unsigned triangleIndex, int &i1, int &i2, int &i3) const =0
Returns the triplet of tex coords indexes for a given triangle.
virtual bool hasTriNormals() const =0
Returns whether the mesh has per-triangle normals.
virtual bool getTriangleNormals(unsigned triangleIndex, CCVector3 &Na, CCVector3 &Nb, CCVector3 &Nc) const =0
Returns a given triangle normal.
virtual bool interpolateNormalsBC(unsigned triIndex, const CCVector3d &w, CCVector3 &N)=0
Interpolates normal(s) inside a given triangle.
virtual int getTriangleMtlIndex(unsigned triangleIndex) const =0
Returns a given triangle material indexes.
virtual void computeInterpolationWeights(unsigned triIndex, const CCVector3 &P, CCVector3d &weights) const
Returns the (barycentric) interpolation weights for a given triangle.
short minimumFileVersion_MeOnly() const override
virtual bool interpolateColors(unsigned triIndex, const CCVector3 &P, ecvColor::Rgb &C)=0
Interpolates RGB colors inside a given triangle.
virtual bool getVertexColorFromMaterial(unsigned triIndex, unsigned char vertIndex, ecvColor::Rgb &C, bool returnColorIfNoTexture)=0
virtual void getTriangleTexCoordinates(unsigned triIndex, TexCoords2D *&tx1, TexCoords2D *&tx2, TexCoords2D *&tx3) const =0
Returns per-triangle texture coordinates (pointer to)
virtual void showMaterials(bool state)
Sets whether textures should be displayed or not.
virtual void getTexCoordinates(unsigned index, TexCoords2D *&tx) const =0
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
void drawMeOnly(CC_DRAW_CONTEXT &context) override
Enables (OpenGL) stipple mask.
virtual unsigned capacity() const =0
Returns max capacity.
virtual void refreshBB()=0
Forces bounding-box update.
virtual bool getColorFromMaterial(unsigned triIndex, const CCVector3 &P, ecvColor::Rgb &C, bool interpolateColorIfNoTexture)=0
virtual bool hasMaterials() const =0
A 3D cloud interface with associated features (color, normals, octree, etc.)
Hierarchical CLOUDVIEWER Object.
virtual ecvOrientedBBox GetOrientedBoundingBox() const
virtual ccHObject & Scale(const double s, const Eigen::Vector3d ¢er)
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
virtual const ccGLMatrix & getGLTransformationHistory() const
Returns the transformation 'history' matrix.
virtual Eigen::Vector3d GetCenter() const
Returns the center of the geometry coordinates.
virtual ccHObject & Translate(const Eigen::Vector3d &translation, bool relative=true)
Apply translation to the geometry coordinates.
virtual void onUpdateOf(ccHObject *obj)
This method is called when another object (geometry) is updated.
virtual ccHObject & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d ¢er)
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
virtual unsigned getUniqueIDForDisplay() const
Returns object unqiue ID used for display.
virtual void applyGLTransformation(const ccGLMatrix &trans)
Applies a GL transformation to the entity.
virtual Eigen::Vector3d GetMaxBound() const
Returns max bounds for geometry coordinates.
virtual Eigen::Vector3d GetMinBound() const
Returns min bounds for geometry coordinates.
virtual ccHObject & Transform(const Eigen::Matrix4d &transformation)
Apply transformation (4x4 matrix) to the geometry coordinates.
virtual void onDeletionOf(const ccHObject *obj)
This method is called when another object is deleted.
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
virtual ccBBox GetAxisAlignedBoundingBox() const
Returns an axis-aligned bounding box of the geometry.
Mesh (triangle) material.
CV_CLASS_ENUM getClassID() const override
Returns class ID.
const ccMaterialSet * getMaterialSet() const override
TextureCoordsContainer * getTexCoordinatesTable() const override
Returns per-triangle texture coordinates array.
NormsIndexesTableType * getTriNormsTable() const override
Returns per-triangle normals shared array.
triangleIndexesContainer * getTrianglesPtr() const
const triangleMaterialIndexesSet * getTriangleMtlIndexesTable() const
Returns the per-triangle material indexes array.
bool hasAdjacencyList() const
Returns true if the mesh contains adjacency normals.
virtual bool IsEmpty() const override
void toggleMaterials() override
Toggles material display state.
void addTriangles(const std::vector< Eigen::Vector3i > &triangles)
std::vector< int > triangle_material_ids_
List of material ids.
void addTriangle(const Eigen::Vector3i &index)
std::vector< Eigen::Vector2d > triangle_uvs_
List of uv coordinates per triangle.
static cloudViewer::VerticesIndexes GetOrderedTriangle(int vidx0, int vidx1, int vidx2)
MESH_SCALAR_FIELD_PROCESS
Mesh scalar field processes.
std::vector< std::unordered_set< int > > adjacency_list_
void clearTriNormals()
Removes per-triangle normals.
bool isSerializable() const override
Returns whether object is serializable of not.
ccGenericPointCloud * getAssociatedCloud() const override
Returns the vertices cloud.
bool hasEigenTextures() const
Returns true if the mesh has texture.
bool normalsAvailable() const override
Returns whether normals are available.
bool hasPerTriangleTexCoordIndexes() const override
Returns whether this mesh as per-triangle triplets of tex coords indexes.
static Eigen::Vector3i GetEigneOrderedTriangle(int vidx0, int vidx1, int vidx2)
bool HasTriangleNormals() const
bool hasTriangleMaterialIds() const
std::vector< cloudViewer::geometry::Image > textures_
Textures of the image.
static Eigen::Vector2i GetOrderedEdge(int vidx0, int vidx1)
Helper function to get an edge with ordered vertex indices.
void shrinkToFit()
Removes unused capacity.
std::vector< std::pair< std::string, Material > > materials_
bool hasPerTriangleMtlIndexes() const
Returns whether this mesh as per-triangle material index.
bool hasTriangleUvs() const
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
A generic mesh with index-based vertex access.
virtual bool interpolateNormals(unsigned triIndex, const CCVector3 &P, CCVector3 &N)
Interpolates normal(s) inside a given triangle.
virtual GenericTriangle * _getTriangle(unsigned triangleIndex)=0
Returns the ith triangle.
virtual VerticesIndexes * getNextTriangleVertIndexes()=0
virtual VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex)=0
Returns the indexes of the vertices of a given triangle.
virtual void getTriangleVertices(unsigned triangleIndex, CCVector3 &A, CCVector3 &B, CCVector3 &C) const =0
Returns the vertices of a given triangle.
virtual unsigned size() const =0
Returns the number of triangles.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the mesh bounding-box.
virtual GenericTriangle * _getNextTriangle()=0
Returns the next triangle (relatively to the global iterator position)
virtual void placeIteratorAtBeginning()=0
Places the mesh iterator at the beginning.
virtual void forEach(genericTriangleAction action)=0
Fast iteration mechanism.
virtual bool hasTriangles() const
A generic triangle interface.
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Graphical progress indicator (thread-safe)
unsigned int CompressedNormType
Compressed normals type.
#define ccMesh_extended_call1(baseName, param1Type, recursiveName)
bool invertNormals(const ccHObject::Container &selectedEntities)
bool computeNormals(const ccHObject::Container &selectedEntities, QWidget *parent)
void SelectByIndex(benchmark::State &state, bool remove_duplicates, const core::Device &device)
static std::unordered_map< Edge< T >, std::vector< size_t >, utility::hash_tuple< Edge< T > > > GetEdgeToTrianglesMap(const core::Tensor &tris_cpu)
void operator+=(MiniVec< T, N > &a, const MiniVec< T, N > &b)
Generic file read and write utility for python interface.
TRIANGULATION_TYPES
Triangulation types.
Eigen::Matrix< Index, 3, 1 > Vector3i
Eigen::Matrix< Index, 2, 1 > Vector2i
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
MaterialParameter(const float v1, const float v2, const float v3, const float v4)
MaterialParameter(const float v1, const float v2, const float v3)
static MaterialParameter CreateRGB(const float r, const float g, const float b)
MaterialParameter(const float v1)
MaterialParameter(const float v1, const float v2)
std::shared_ptr< cloudViewer::geometry::Image > anisotropy
std::shared_ptr< cloudViewer::geometry::Image > ambientOcclusion
std::shared_ptr< cloudViewer::geometry::Image > metallic
std::shared_ptr< cloudViewer::geometry::Image > clearCoat
std::unordered_map< std::string, MaterialParameter > floatParameters
std::shared_ptr< cloudViewer::geometry::Image > reflectance
MaterialParameter baseColor
std::shared_ptr< cloudViewer::geometry::Image > albedo
std::unordered_map< std::string, cloudViewer::geometry::Image > additionalMaps
std::shared_ptr< cloudViewer::geometry::Image > clearCoatRoughness
std::shared_ptr< cloudViewer::geometry::Image > roughness
std::shared_ptr< cloudViewer::geometry::Image > normalMap
Triangle described by the indexes of its 3 vertices.