Open3D (C++ API)  0.18.0
TetraMesh.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Eigen/Core>
11 #include <Eigen/StdVector>
12 #include <memory>
13 #include <vector>
14 
16 #include "open3d/utility/Eigen.h"
17 #include "open3d/utility/Helper.h"
18 
19 namespace open3d {
20 namespace geometry {
21 
22 class PointCloud;
23 class TriangleMesh;
24 
29 class TetraMesh : public MeshBase {
30 public:
38  TetraMesh(const std::vector<Eigen::Vector3d> &vertices,
39  const std::vector<Eigen::Vector4i, utility::Vector4i_allocator>
40  &tetras)
41  : MeshBase(Geometry::GeometryType::TetraMesh, vertices),
42  tetras_(tetras) {}
43  ~TetraMesh() override {}
44 
45 public:
46  TetraMesh &Clear() override;
47 
48 public:
49  TetraMesh &operator+=(const TetraMesh &mesh);
50  TetraMesh operator+(const TetraMesh &mesh) const;
51 
55 
60 
64 
69 
71  bool HasTetras() const {
72  return vertices_.size() > 0 && tetras_.size() > 0;
73  }
74 
81  std::shared_ptr<TriangleMesh> ExtractTriangleMesh(
82  const std::vector<double> &values, double level);
83 
89  static std::tuple<std::shared_ptr<TetraMesh>, std::vector<size_t>>
90  CreateFromPointCloud(const PointCloud &point_cloud);
91 
92 protected:
93  // Forward child class type to avoid indirect nonvirtual base
95 
96 public:
98  std::vector<Eigen::Vector4i, utility::Vector4i_allocator> tetras_;
99 };
100 
101 } // namespace geometry
102 } // namespace open3d
The base geometry class.
Definition: Geometry.h:18
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:23
MeshBash Class.
Definition: MeshBase.h:32
std::vector< Eigen::Vector3d > vertices_
Vertex coordinates.
Definition: MeshBase.h:149
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition: PointCloud.h:36
Tetra mesh contains vertices and tetrahedra represented by the indices to the vertices.
Definition: TetraMesh.h:29
TetraMesh()
Default Constructor.
Definition: TetraMesh.h:32
TetraMesh & RemoveUnreferencedVertices()
This function removes vertices from the tetra mesh that are not referenced in any tetrahedron of the ...
Definition: TetraMesh.cpp:114
static std::tuple< std::shared_ptr< TetraMesh >, std::vector< size_t > > CreateFromPointCloud(const PointCloud &point_cloud)
Function that creates a tetrahedral mesh (TetraMeshFactory.cpp). from a point cloud.
Definition: TetraMeshFactory.cpp:17
TetraMesh & RemoveDuplicatedTetras()
Function that removes duplicated tetrahedra, i.e., removes tetrahedra that reference the same four ve...
Definition: TetraMesh.cpp:84
TetraMesh & RemoveDegenerateTetras()
Function that removes degenerate tetrahedra, i.e., tetrahedra that reference a single vertex multiple...
Definition: TetraMesh.cpp:151
TetraMesh(Geometry::GeometryType type)
Definition: TetraMesh.h:94
std::shared_ptr< TriangleMesh > ExtractTriangleMesh(const std::vector< double > &values, double level)
Function to extract a triangle mesh of the specified iso-surface at a level This method applies prima...
Definition: TetraMesh.cpp:171
TetraMesh operator+(const TetraMesh &mesh) const
Definition: TetraMesh.cpp:44
TetraMesh & operator+=(const TetraMesh &mesh)
Definition: TetraMesh.cpp:29
TetraMesh(const std::vector< Eigen::Vector3d > &vertices, const std::vector< Eigen::Vector4i, utility::Vector4i_allocator > &tetras)
Parameterized Constructor.
Definition: TetraMesh.h:38
~TetraMesh() override
Definition: TetraMesh.h:43
TetraMesh & RemoveDuplicatedVertices()
Function that removes duplicated verties, i.e., vertices that have identical coordinates.
Definition: TetraMesh.cpp:48
bool HasTetras() const
Returns true if the mesh contains tetras.
Definition: TetraMesh.h:71
std::vector< Eigen::Vector4i, utility::Vector4i_allocator > tetras_
List of tetras denoted by the index of points forming the tetra.
Definition: TetraMesh.h:98
TetraMesh & Clear() override
Clear all elements in the geometry.
Definition: TetraMesh.cpp:23
char type
Definition: FilePCD.cpp:41
Definition: PinholeCameraIntrinsic.cpp:16