Open3D (C++ API)
TriangleMesh.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <Eigen/Core>
30 #include <memory>
31 #include <numeric>
32 #include <tuple>
33 #include <unordered_map>
34 #include <unordered_set>
35 #include <vector>
36 
37 #include "Open3D/Geometry/Image.h"
39 #include "Open3D/Utility/Helper.h"
40 
41 namespace open3d {
42 namespace geometry {
43 
44 class PointCloud;
45 class TetraMesh;
46 
54 class TriangleMesh : public MeshBase {
55 public:
62  TriangleMesh(const std::vector<Eigen::Vector3d> &vertices,
63  const std::vector<Eigen::Vector3i> &triangles)
65  triangles_(triangles) {}
66  ~TriangleMesh() override {}
67 
68 public:
69  virtual TriangleMesh &Clear() override;
70  virtual TriangleMesh &Transform(
71  const Eigen::Matrix4d &transformation) override;
72  virtual TriangleMesh &Rotate(const Eigen::Matrix3d &R,
73  bool center = true) override;
74 
75 public:
76  TriangleMesh &operator+=(const TriangleMesh &mesh);
77  TriangleMesh operator+(const TriangleMesh &mesh) const;
78 
80  bool HasTriangles() const {
81  return vertices_.size() > 0 && triangles_.size() > 0;
82  }
83 
85  bool HasTriangleNormals() const {
86  return HasTriangles() && triangles_.size() == triangle_normals_.size();
87  }
88 
90  bool HasAdjacencyList() const {
91  return vertices_.size() > 0 &&
92  adjacency_list_.size() == vertices_.size();
93  }
94 
95  bool HasTriangleUvs() const {
96  return HasTriangles() && triangle_uvs_.size() == 3 * triangles_.size();
97  }
98 
100  bool HasTextures() const {
101  bool is_all_texture_valid = std::accumulate(
102  textures_.begin(), textures_.end(), true,
103  [](bool a, const Image &b) { return a && !b.IsEmpty(); });
104  return !textures_.empty() && is_all_texture_valid;
105  }
106 
107  bool HasTriangleMaterialIds() const {
108  return HasTriangles() &&
109  triangle_material_ids_.size() == triangles_.size();
110  }
111 
115  for (size_t i = 0; i < triangle_normals_.size(); i++) {
116  triangle_normals_[i].normalize();
117  if (std::isnan(triangle_normals_[i](0))) {
118  triangle_normals_[i] = Eigen::Vector3d(0.0, 0.0, 1.0);
119  }
120  }
121  return *this;
122  }
123 
126  TriangleMesh &ComputeTriangleNormals(bool normalized = true);
127 
130  TriangleMesh &ComputeVertexNormals(bool normalized = true);
131 
135 
139 
144 
148 
154 
160 
167  TriangleMesh &MergeCloseVertices(double eps);
168 
178  std::shared_ptr<TriangleMesh> FilterSharpen(
179  int number_of_iterations,
180  double strength,
181  FilterScope scope = FilterScope::All) const;
182 
191  std::shared_ptr<TriangleMesh> FilterSmoothSimple(
192  int number_of_iterations,
193  FilterScope scope = FilterScope::All) const;
194 
205  std::shared_ptr<TriangleMesh> FilterSmoothLaplacian(
206  int number_of_iterations,
207  double lambda,
208  FilterScope scope = FilterScope::All) const;
209 
220  std::shared_ptr<TriangleMesh> FilterSmoothTaubin(
221  int number_of_iterations,
222  double lambda = 0.5,
223  double mu = -0.53,
224  FilterScope scope = FilterScope::All) const;
225 
229  int EulerPoincareCharacteristic() const;
230 
234  std::vector<Eigen::Vector2i> GetNonManifoldEdges(
235  bool allow_boundary_edges = true) const;
236 
241  bool IsEdgeManifold(bool allow_boundary_edges = true) const;
242 
246  std::vector<int> GetNonManifoldVertices() const;
247 
251  bool IsVertexManifold() const;
252 
255  std::vector<Eigen::Vector2i> GetSelfIntersectingTriangles() const;
256 
259  bool IsSelfIntersecting() const;
260 
263  bool IsBoundingBoxIntersecting(const TriangleMesh &other) const;
264 
267  bool IsIntersecting(const TriangleMesh &other) const;
268 
272  bool IsOrientable() const;
273 
277  bool IsWatertight() const;
278 
282  bool OrientTriangles();
283 
286  std::unordered_map<Eigen::Vector2i,
287  std::vector<int>,
289  GetEdgeToTrianglesMap() const;
290 
293  std::unordered_map<Eigen::Vector2i,
294  std::vector<int>,
296  GetEdgeToVerticesMap() const;
297 
299  static double ComputeTriangleArea(const Eigen::Vector3d &p0,
300  const Eigen::Vector3d &p1,
301  const Eigen::Vector3d &p2);
302 
305  double GetTriangleArea(size_t triangle_idx) const;
306 
307  static inline Eigen::Vector3i GetOrderedTriangle(int vidx0,
308  int vidx1,
309  int vidx2) {
310  if (vidx0 > vidx2) {
311  std::swap(vidx0, vidx2);
312  }
313  if (vidx0 > vidx1) {
314  std::swap(vidx0, vidx1);
315  }
316  if (vidx1 > vidx2) {
317  std::swap(vidx1, vidx2);
318  }
319  return Eigen::Vector3i(vidx0, vidx1, vidx2);
320  }
321 
324  double GetSurfaceArea() const;
325 
328  double GetSurfaceArea(std::vector<double> &triangle_areas) const;
329 
333  static Eigen::Vector4d ComputeTrianglePlane(const Eigen::Vector3d &p0,
334  const Eigen::Vector3d &p1,
335  const Eigen::Vector3d &p2);
336 
339  Eigen::Vector4d GetTrianglePlane(size_t triangle_idx) const;
340 
342  static inline Eigen::Vector2i GetOrderedEdge(int vidx0, int vidx1) {
343  return Eigen::Vector2i(std::min(vidx0, vidx1), std::max(vidx0, vidx1));
344  }
345 
348  std::shared_ptr<PointCloud> SamplePointsUniformlyImpl(
349  size_t number_of_points,
350  std::vector<double> &triangle_areas,
351  double surface_area,
352  bool use_triangle_normal,
353  int seed);
354 
361  std::shared_ptr<PointCloud> SamplePointsUniformly(
362  size_t number_of_points,
363  bool use_triangle_normal = false,
364  int seed = -1);
365 
377  std::shared_ptr<PointCloud> SamplePointsPoissonDisk(
378  size_t number_of_points,
379  double init_factor = 5,
380  const std::shared_ptr<PointCloud> pcl_init = nullptr,
381  bool use_triangle_normal = false,
382  int seed = -1);
383 
389  std::shared_ptr<TriangleMesh> SubdivideMidpoint(
390  int number_of_iterations) const;
391 
397  std::shared_ptr<TriangleMesh> SubdivideLoop(int number_of_iterations) const;
398 
405  std::shared_ptr<TriangleMesh> SimplifyVertexClustering(
406  double voxel_size,
407  SimplificationContraction contraction =
409 
415  std::shared_ptr<TriangleMesh> SimplifyQuadricDecimation(
416  int target_number_of_triangles) const;
417 
422  std::shared_ptr<TriangleMesh> SelectByIndex(
423  const std::vector<size_t> &indices) const;
424 
429  std::shared_ptr<TriangleMesh> Crop(
430  const AxisAlignedBoundingBox &bbox) const;
431 
436  std::shared_ptr<TriangleMesh> Crop(const OrientedBoundingBox &bbox) const;
437 
444  std::tuple<std::vector<int>, std::vector<size_t>, std::vector<double>>
446 
453  void RemoveTrianglesByIndex(const std::vector<size_t> &triangle_indices);
454 
461  void RemoveTrianglesByMask(const std::vector<bool> &triangle_mask);
462 
469  void RemoveVerticesByIndex(const std::vector<size_t> &vertex_indices);
470 
477  void RemoveVerticesByMask(const std::vector<bool> &vertex_mask);
478 
492  std::shared_ptr<TriangleMesh> DeformAsRigidAsPossible(
493  const std::vector<int> &constraint_vertex_indices,
494  const std::vector<Eigen::Vector3d> &constraint_vertex_positions,
495  size_t max_iter,
498  double smoothed_alpha = 0.01) const;
499 
511  static std::shared_ptr<TriangleMesh> CreateFromPointCloudAlphaShape(
512  const PointCloud &pcd,
513  double alpha,
514  std::shared_ptr<TetraMesh> tetra_mesh = nullptr,
515  std::vector<size_t> *pt_map = nullptr);
516 
529  static std::shared_ptr<TriangleMesh> CreateFromPointCloudBallPivoting(
530  const PointCloud &pcd, const std::vector<double> &radii);
531 
553  static std::tuple<std::shared_ptr<TriangleMesh>, std::vector<double>>
555  size_t depth = 8,
556  size_t width = 0,
557  float scale = 1.1f,
558  bool linear_fit = false);
559 
564  static std::shared_ptr<TriangleMesh> CreateTetrahedron(double radius = 1.0);
565 
570  static std::shared_ptr<TriangleMesh> CreateOctahedron(double radius = 1.0);
571 
575  static std::shared_ptr<TriangleMesh> CreateIcosahedron(double radius = 1.0);
576 
582  static std::shared_ptr<TriangleMesh> CreateBox(double width = 1.0,
583  double height = 1.0,
584  double depth = 1.0);
585 
595  static std::shared_ptr<TriangleMesh> CreateSphere(double radius = 1.0,
596  int resolution = 20);
597 
608  static std::shared_ptr<TriangleMesh> CreateCylinder(double radius = 1.0,
609  double height = 2.0,
610  int resolution = 20,
611  int split = 4);
612 
622  static std::shared_ptr<TriangleMesh> CreateCone(double radius = 1.0,
623  double height = 2.0,
624  int resolution = 20,
625  int split = 1);
626 
637  static std::shared_ptr<TriangleMesh> CreateTorus(
638  double torus_radius = 1.0,
639  double tube_radius = 0.5,
640  int radial_resolution = 30,
641  int tubular_resolution = 20);
642 
663  static std::shared_ptr<TriangleMesh> CreateArrow(
664  double cylinder_radius = 1.0,
665  double cone_radius = 1.5,
666  double cylinder_height = 5.0,
667  double cone_height = 4.0,
668  int resolution = 20,
669  int cylinder_split = 4,
670  int cone_split = 1);
671 
677  static std::shared_ptr<TriangleMesh> CreateCoordinateFrame(
678  double size = 1.0,
679  const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0));
680 
690  static std::shared_ptr<TriangleMesh> CreateMoebius(int length_split = 70,
691  int width_split = 15,
692  int twists = 1,
693  double radius = 1,
694  double flatness = 1,
695  double width = 1,
696  double scale = 1);
697 
698 protected:
699  // Forward child class type to avoid indirect nonvirtual base
701 
703  std::shared_ptr<TriangleMesh> &mesh,
704  const std::vector<Eigen::Vector3d> &prev_vertices,
705  const std::vector<Eigen::Vector3d> &prev_vertex_normals,
706  const std::vector<Eigen::Vector3d> &prev_vertex_colors,
707  const std::vector<std::unordered_set<int>> &adjacency_list,
708  double lambda,
709  bool filter_vertex,
710  bool filter_normal,
711  bool filter_color) const;
712 
721  std::unordered_map<Eigen::Vector2i,
722  double,
725  const std::unordered_map<Eigen::Vector2i,
726  std::vector<int>,
728  &edges_to_vertices,
729  double min_weight = std::numeric_limits<double>::lowest()) const;
730 
731 public:
733  std::vector<Eigen::Vector3i> triangles_;
735  std::vector<Eigen::Vector3d> triangle_normals_;
738  std::vector<std::unordered_set<int>> adjacency_list_;
740  std::vector<Eigen::Vector2d> triangle_uvs_;
742  std::vector<int> triangle_material_ids_;
744  std::vector<Image> textures_;
745 };
746 
747 } // namespace geometry
748 } // namespace open3d
static std::shared_ptr< TriangleMesh > CreateFromPointCloudBallPivoting(const PointCloud &pcd, const std::vector< double > &radii)
Definition: SurfaceReconstructionBallPivoting.cpp:750
bool HasTriangleMaterialIds() const
Definition: TriangleMesh.h:107
bool IsSelfIntersecting() const
Definition: TriangleMesh.cpp:1347
std::shared_ptr< PointCloud > SamplePointsUniformlyImpl(size_t number_of_points, std::vector< double > &triangle_areas, double surface_area, bool use_triangle_normal, int seed)
Definition: TriangleMesh.cpp:429
std::vector< Eigen::Vector3i > triangles_
List of triangles denoted by the index of points forming the triangle.
Definition: TriangleMesh.h:733
TriangleMesh & RemoveDuplicatedTriangles()
Function that removes duplicated triangles, i.e., removes triangles that reference the same three ver...
Definition: TriangleMesh.cpp:707
bool IsOrientable() const
Definition: TriangleMesh.cpp:1097
void RemoveVerticesByIndex(const std::vector< size_t > &vertex_indices)
This function removes the vertices with index in vertex_indices. Note that also all triangles associa...
Definition: TriangleMesh.cpp:1486
void RemoveVerticesByMask(const std::vector< bool > &vertex_mask)
This function removes the vertices that are masked in vertex_mask. Note that also all triangles assoc...
Definition: TriangleMesh.cpp:1503
Definition: Helper.h:92
std::shared_ptr< TriangleMesh > SubdivideLoop(int number_of_iterations) const
Definition: TriangleMeshSubdivide.cpp:116
The base geometry class.
Definition: Geometry.h:35
std::vector< int > GetNonManifoldVertices() const
Definition: TriangleMesh.cpp:1255
std::shared_ptr< TriangleMesh > FilterSmoothSimple(int number_of_iterations, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh with simple neighbour average.
Definition: TriangleMesh.cpp:226
TriangleMesh & MergeCloseVertices(double eps)
Function that will merge close by vertices to a single one. The vertex position, normal and color wil...
Definition: TriangleMesh.cpp:912
static std::shared_ptr< TriangleMesh > CreateMoebius(int length_split=70, int width_split=15, int twists=1, double radius=1, double flatness=1, double width=1, double scale=1)
Definition: TriangleMeshFactory.cpp:441
A bounding box that is aligned along the coordinate axes.
Definition: BoundingVolume.h:130
bool HasTextures() const
Returns true if the mesh has texture.
Definition: TriangleMesh.h:100
std::unordered_map< Eigen::Vector2i, std::vector< int >, utility::hash_eigen::hash< Eigen::Vector2i > > GetEdgeToTrianglesMap() const
Definition: TriangleMesh.cpp:1116
bool IsBoundingBoxIntersecting(const TriangleMesh &other) const
Definition: TriangleMesh.cpp:1351
TriangleMesh()
Default Constructor.
Definition: TriangleMesh.h:57
void RemoveTrianglesByIndex(const std::vector< size_t > &triangle_indices)
This function removes the triangles with index in triangle_indices. Call RemoveUnreferencedVertices t...
Definition: TriangleMesh.cpp:1446
std::shared_ptr< TriangleMesh > FilterSharpen(int number_of_iterations, double strength, FilterScope scope=FilterScope::All) const
Function to sharpen triangle mesh.
Definition: TriangleMesh.cpp:155
MeshBash Class.
Definition: MeshBase.h:51
MeshBase & NormalizeNormals()
Normalize vertex normals to length 1.
Definition: MeshBase.h:116
A bounding box oriented along an arbitrary frame of reference.
Definition: BoundingVolume.h:44
A point cloud consists of point coordinates, and optionally point colors and point normals...
Definition: PointCloud.h:54
bool IsEdgeManifold(bool allow_boundary_edges=true) const
Definition: TriangleMesh.cpp:1242
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMesh.cpp:124
static std::shared_ptr< TriangleMesh > CreateSphere(double radius=1.0, int resolution=20)
Definition: TriangleMeshFactory.cpp:157
bool HasTriangleUvs() const
Definition: TriangleMesh.h:95
static double ComputeTriangleArea(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
Function that computes the area of a mesh triangle.
Definition: TriangleMesh.cpp:1151
static Eigen::Vector2i GetOrderedEdge(int vidx0, int vidx1)
Helper function to get an edge with ordered vertex indices.
Definition: TriangleMesh.h:342
static std::shared_ptr< TriangleMesh > CreateBox(double width=1.0, double height=1.0, double depth=1.0)
Definition: TriangleMeshFactory.cpp:120
Eigen::Vector4d GetTrianglePlane(size_t triangle_idx) const
Definition: TriangleMesh.cpp:1204
std::tuple< std::vector< int >, std::vector< size_t >, std::vector< double > > ClusterConnectedTriangles() const
Function that clusters connected triangles, i.e., triangles that are connected via edges are assigned...
Definition: TriangleMesh.cpp:1379
static std::shared_ptr< TriangleMesh > CreateCoordinateFrame(double size=1.0, const Eigen::Vector3d &origin=Eigen::Vector3d(0.0, 0.0, 0.0))
Definition: TriangleMeshFactory.cpp:402
std::vector< Eigen::Vector2i > GetSelfIntersectingTriangles() const
Definition: TriangleMesh.cpp:1315
TriangleMesh & operator+=(const TriangleMesh &mesh)
Definition: TriangleMesh.cpp:72
std::shared_ptr< TriangleMesh > FilterSmoothLaplacian(int number_of_iterations, double lambda, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using Laplacian.
Definition: TriangleMesh.cpp:342
static std::tuple< std::shared_ptr< TriangleMesh >, std::vector< double > > CreateFromPointCloudPoisson(const PointCloud &pcd, size_t depth=8, size_t width=0, float scale=1.1f, bool linear_fit=false)
Function that computes a triangle mesh from a oriented PointCloud pcd. This implements the Screened P...
Definition: SurfaceReconstructionPoisson.cpp:729
static std::shared_ptr< TriangleMesh > CreateCylinder(double radius=1.0, double height=2.0, int resolution=20, int split=4)
Definition: TriangleMeshFactory.cpp:202
int size
Definition: FilePCD.cpp:56
TriangleMesh & RemoveDegenerateTriangles()
Function that removes degenerate triangles, i.e., triangles that reference a single vertex multiple t...
Definition: TriangleMesh.cpp:802
std::shared_ptr< TriangleMesh > Crop(const AxisAlignedBoundingBox &bbox) const
Definition: TriangleMesh.cpp:1632
static std::shared_ptr< TriangleMesh > CreateTetrahedron(double radius=1.0)
Definition: TriangleMeshFactory.cpp:33
bool IsVertexManifold() const
Definition: TriangleMesh.cpp:1311
double voxel_size
Definition: FilePLY.cpp:285
bool IsIntersecting(const TriangleMesh &other) const
Definition: TriangleMesh.cpp:1356
std::unordered_map< Eigen::Vector2i, double, utility::hash_eigen::hash< Eigen::Vector2i > > ComputeEdgeWeightsCot(const std::unordered_map< Eigen::Vector2i, std::vector< int >, utility::hash_eigen::hash< Eigen::Vector2i >> &edges_to_vertices, double min_weight=std::numeric_limits< double >::lowest()) const
Function that computes for each edge in the triangle mesh and passed as parameter edges_to_vertices t...
Definition: TriangleMesh.cpp:1656
TriangleMesh & ComputeAdjacencyList()
Function to compute adjacency list, call before adjacency list is needed.
Definition: TriangleMesh.cpp:141
bool IsWatertight() const
Definition: TriangleMesh.cpp:1102
std::shared_ptr< TriangleMesh > DeformAsRigidAsPossible(const std::vector< int > &constraint_vertex_indices, const std::vector< Eigen::Vector3d > &constraint_vertex_positions, size_t max_iter, DeformAsRigidAsPossibleEnergy energy=DeformAsRigidAsPossibleEnergy::Spokes, double smoothed_alpha=0.01) const
This function deforms the mesh using the method by Sorkine and Alexa, "As-Rigid-As-Possible Surface M...
Definition: TriangleMeshDeformation.cpp:38
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
Definition: TriangleMesh.h:113
TriangleMesh(const std::vector< Eigen::Vector3d > &vertices, const std::vector< Eigen::Vector3i > &triangles)
Parameterized Constructor.
Definition: TriangleMesh.h:62
virtual TriangleMesh & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
Definition: TriangleMesh.cpp:60
FilterScope
Indicates the scope of filter operations.
Definition: MeshBase.h:70
SimplificationContraction
Indicates the method that is used for mesh simplification if multiple vertices are combined to a sing...
Definition: MeshBase.h:61
DeformAsRigidAsPossibleEnergy
Definition: MeshBase.h:76
virtual TriangleMesh & Clear() override
Clear all elements in the geometry.
Definition: TriangleMesh.cpp:49
std::vector< Image > textures_
Textures of the image.
Definition: TriangleMesh.h:744
std::unordered_map< Eigen::Vector2i, std::vector< int >, utility::hash_eigen::hash< Eigen::Vector2i > > GetEdgeToVerticesMap() const
Definition: TriangleMesh.cpp:1135
virtual TriangleMesh & Rotate(const Eigen::Matrix3d &R, bool center=true) override
Apply rotation to the geometry coordinates and normals.
Definition: TriangleMesh.cpp:66
void RemoveTrianglesByMask(const std::vector< bool > &triangle_mask)
This function removes the triangles that are masked in triangle_mask. Call RemoveUnreferencedVertices...
Definition: TriangleMesh.cpp:1463
bool HasTriangles() const
Returns true if the mesh contains triangles.
Definition: TriangleMesh.h:80
TriangleMesh operator+(const TriangleMesh &mesh) const
Definition: TriangleMesh.cpp:105
static Eigen::Vector4d ComputeTrianglePlane(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
Definition: TriangleMesh.cpp:1188
bool OrientTriangles()
Definition: TriangleMesh.cpp:1106
TriangleMesh & RemoveNonManifoldEdges()
Function that removes all non-manifold edges, by successively deleting triangles with the smallest su...
Definition: TriangleMesh.cpp:832
static std::shared_ptr< TriangleMesh > CreateTorus(double torus_radius=1.0, double tube_radius=0.5, int radial_resolution=30, int tubular_resolution=20)
Definition: TriangleMeshFactory.cpp:307
char type
Definition: FilePCD.cpp:57
std::shared_ptr< TriangleMesh > SubdivideMidpoint(int number_of_iterations) const
Definition: TriangleMeshSubdivide.cpp:38
static std::shared_ptr< TriangleMesh > CreateFromPointCloudAlphaShape(const PointCloud &pcd, double alpha, std::shared_ptr< TetraMesh > tetra_mesh=nullptr, std::vector< size_t > *pt_map=nullptr)
Alpha shapes are a generalization of the convex hull. With decreasing alpha value the shape schrinks ...
Definition: SurfaceReconstructionAlphaShape.cpp:41
void FilterSmoothLaplacianHelper(std::shared_ptr< TriangleMesh > &mesh, const std::vector< Eigen::Vector3d > &prev_vertices, const std::vector< Eigen::Vector3d > &prev_vertex_normals, const std::vector< Eigen::Vector3d > &prev_vertex_colors, const std::vector< std::unordered_set< int >> &adjacency_list, double lambda, bool filter_vertex, bool filter_normal, bool filter_color) const
Definition: TriangleMesh.cpp:292
static std::shared_ptr< TriangleMesh > CreateArrow(double cylinder_radius=1.0, double cone_radius=1.5, double cylinder_height=5.0, double cone_height=4.0, int resolution=20, int cylinder_split=4, int cone_split=1)
Definition: TriangleMeshFactory.cpp:359
bool HasAdjacencyList() const
Returns true if the mesh contains adjacency normals.
Definition: TriangleMesh.h:90
Eigen::Vector3d origin
Definition: FilePLY.cpp:284
static std::shared_ptr< TriangleMesh > CreateOctahedron(double radius=1.0)
Definition: TriangleMeshFactory.cpp:55
Definition: Reduction.cpp:36
double GetTriangleArea(size_t triangle_idx) const
Definition: TriangleMesh.cpp:1160
std::vector< Eigen::Vector2i > GetNonManifoldEdges(bool allow_boundary_edges=true) const
Definition: TriangleMesh.cpp:1228
std::shared_ptr< PointCloud > SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false, int seed=-1)
Definition: TriangleMesh.cpp:497
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:40
~TriangleMesh() override
Definition: TriangleMesh.h:66
std::shared_ptr< PointCloud > SamplePointsPoissonDisk(size_t number_of_points, double init_factor=5, const std::shared_ptr< PointCloud > pcl_init=nullptr, bool use_triangle_normal=false, int seed=-1)
Definition: TriangleMesh.cpp:517
static std::shared_ptr< TriangleMesh > CreateIcosahedron(double radius=1.0)
Definition: TriangleMeshFactory.cpp:78
int height
Definition: FilePCD.cpp:69
int EulerPoincareCharacteristic() const
Definition: TriangleMesh.cpp:1212
std::vector< std::unordered_set< int > > adjacency_list_
Definition: TriangleMesh.h:738
std::shared_ptr< TriangleMesh > SelectByIndex(const std::vector< size_t > &indices) const
Definition: TriangleMesh.cpp:1547
std::vector< Eigen::Vector3d > triangle_normals_
Triangle normals.
Definition: TriangleMesh.h:735
TriangleMesh(Geometry::GeometryType type)
Definition: TriangleMesh.h:700
TriangleMesh & RemoveUnreferencedVertices()
This function removes vertices from the triangle mesh that are not referenced in any triangle of the ...
Definition: TriangleMesh.cpp:759
bool HasTriangleNormals() const
Returns true if the mesh contains triangle normals.
Definition: TriangleMesh.h:85
std::vector< Eigen::Vector3d > vertices_
Vertex coordinates.
Definition: MeshBase.h:147
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition: TriangleMesh.h:54
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition: TriangleMesh.cpp:109
std::vector< int > triangle_material_ids_
List of material ids.
Definition: TriangleMesh.h:742
TriangleMesh & RemoveDuplicatedVertices()
Function that removes duplicated verties, i.e., vertices that have identical coordinates.
Definition: TriangleMesh.cpp:663
double GetSurfaceArea() const
Definition: TriangleMesh.cpp:1168
static Eigen::Vector3i GetOrderedTriangle(int vidx0, int vidx1, int vidx2)
Definition: TriangleMesh.h:307
static std::shared_ptr< TriangleMesh > CreateCone(double radius=1.0, double height=2.0, int resolution=20, int split=1)
Definition: TriangleMeshFactory.cpp:254
std::shared_ptr< TriangleMesh > SimplifyVertexClustering(double voxel_size, SimplificationContraction contraction=SimplificationContraction::Average) const
Definition: TriangleMeshSimplification.cpp:92
std::shared_ptr< TriangleMesh > SimplifyQuadricDecimation(int target_number_of_triangles) const
Definition: TriangleMeshSimplification.cpp:267
std::vector< Eigen::Vector2d > triangle_uvs_
List of uv coordinates per triangle.
Definition: TriangleMesh.h:740
The Image class stores image with customizable width, height, num of channels and bytes per channel...
Definition: Image.h:53
std::shared_ptr< TriangleMesh > FilterSmoothTaubin(int number_of_iterations, double lambda=0.5, double mu=-0.53, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using method of Taubin, "Curve and Surface Smoothing Without Shrinka...
Definition: TriangleMesh.cpp:381
int width
Definition: FilePCD.cpp:68