Open3D (C++ API)
|
#include <TriangleMesh.h>
Public Types | |
enum | SimplificationContraction { SimplificationContraction::Average, SimplificationContraction::Quadric } |
enum | FilterScope { FilterScope::All, FilterScope::Color, FilterScope::Normal, FilterScope::Vertex } |
Public Types inherited from open3d::geometry::Geometry3D | |
enum | RotationType { RotationType::XYZ, RotationType::YZX, RotationType::ZXY, RotationType::XZY, RotationType::ZYX, RotationType::YXZ, RotationType::AxisAngle } |
Public Types inherited from open3d::geometry::Geometry | |
enum | GeometryType { GeometryType::Unspecified = 0, GeometryType::PointCloud = 1, GeometryType::VoxelGrid = 2, GeometryType::Octree = 3, GeometryType::LineSet = 4, GeometryType::TriangleMesh = 5, GeometryType::HalfEdgeTriangleMesh = 6, GeometryType::Image = 7 } |
Public Member Functions | |
TriangleMesh () | |
~TriangleMesh () override | |
void | Clear () override |
bool | IsEmpty () const override |
Eigen::Vector3d | GetMinBound () const override |
Eigen::Vector3d | GetMaxBound () const override |
TriangleMesh & | Transform (const Eigen::Matrix4d &transformation) override |
TriangleMesh & | Translate (const Eigen::Vector3d &translation) override |
TriangleMesh & | Scale (const double scale, bool center=true) override |
TriangleMesh & | Rotate (const Eigen::Vector3d &rotation, bool center=true, RotationType type=RotationType::XYZ) override |
TriangleMesh & | operator+= (const TriangleMesh &mesh) |
TriangleMesh | operator+ (const TriangleMesh &mesh) const |
void | ComputeTriangleNormals (bool normalized=true) |
Function to compute triangle normals, usually called before rendering. More... | |
void | ComputeVertexNormals (bool normalized=true) |
Function to compute vertex normals, usually called before rendering. More... | |
void | ComputeAdjacencyList () |
Function to compute adjacency list, call before adjacency list is needed. More... | |
virtual void | RemoveDuplicatedVertices () |
virtual void | RemoveDuplicatedTriangles () |
virtual void | RemoveUnreferencedVertices () |
virtual void | RemoveDegenerateTriangles () |
virtual void | RemoveNonManifoldEdges () |
void | FilterSharpen (int number_of_iterations, double strength, FilterScope scope=FilterScope::All) |
void | FilterSmoothSimple (int number_of_iterations, FilterScope scope=FilterScope::All) |
void | FilterSmoothLaplacian (int number_of_iterations, double lambda, FilterScope scope=FilterScope::All) |
void | FilterSmoothTaubin (int number_of_iterations, double lambda=0.5, double mu=-0.53, FilterScope scope=FilterScope::All) |
bool | HasVertices () const |
bool | HasTriangles () const |
bool | HasVertexNormals () const |
bool | HasVertexColors () const |
bool | HasTriangleNormals () const |
bool | HasAdjacencyList () const |
void | NormalizeNormals () |
void | PaintUniformColor (const Eigen::Vector3d &color) |
Assigns each vertex in the TriangleMesh the same color. More... | |
int | EulerPoincareCharacteristic () const |
std::vector< Eigen::Vector2i > | GetNonManifoldEdges (bool allow_boundary_edges=true) const |
bool | IsEdgeManifold (bool allow_boundary_edges=true) const |
std::vector< int > | GetNonManifoldVertices () const |
bool | IsVertexManifold () const |
std::vector< Eigen::Vector2i > | GetSelfIntersectingTriangles () const |
bool | IsSelfIntersecting () const |
bool | IsBoundingBoxIntersecting (const TriangleMesh &other) const |
bool | IsIntersecting (const TriangleMesh &other) const |
bool | IsOrientable () const |
bool | OrientTriangles () |
std::unordered_map< Eigen::Vector2i, std::vector< int >, utility::hash_eigen::hash< Eigen::Vector2i > > | GetEdgeToTrianglesMap () const |
double | GetTriangleArea (size_t triangle_idx) const |
double | GetSurfaceArea () const |
double | GetSurfaceArea (std::vector< double > &triangle_areas) const |
Eigen::Vector4d | GetTrianglePlane (size_t triangle_idx) const |
Public Member Functions inherited from open3d::geometry::Geometry3D | |
~Geometry3D () override | |
Public Member Functions inherited from open3d::geometry::Geometry | |
virtual | ~Geometry () |
GeometryType | GetGeometryType () const |
int | Dimension () const |
Data Fields | |
std::vector< Eigen::Vector3d > | vertices_ |
std::vector< Eigen::Vector3d > | vertex_normals_ |
std::vector< Eigen::Vector3d > | vertex_colors_ |
std::vector< Eigen::Vector3i > | triangles_ |
std::vector< Eigen::Vector3d > | triangle_normals_ |
std::vector< std::unordered_set< int > > | adjacency_list_ |
Protected Member Functions | |
TriangleMesh (Geometry::GeometryType type) | |
Protected Member Functions inherited from open3d::geometry::Geometry3D | |
Geometry3D (GeometryType type) | |
Eigen::Matrix3d | GetRotationMatrix (const Eigen::Vector3d &rotation, RotationType type=RotationType::XYZ) const |
Protected Member Functions inherited from open3d::geometry::Geometry | |
Geometry (GeometryType type, int dimension) | |
|
strong |
Indicates the scope of filter operations.
All | indicates that all properties (color, normal, vertex position) are filtered. |
Color | indicates that only the colors are filtered. |
Normal | indicates that only the normals are filtered. |
Vertex | indicates that only the vertex positions are filtered. |
Enumerator | |
---|---|
All | |
Color | |
Normal | |
Vertex |
Indicates the method that is used for mesh simplification if multiple vertices are combined to a single one.
Average | indicates that the average position is computed as output. |
Quadric | indicates that the distance to the adjacent triangle planes is minimized. Cf. "Simplifying Surfaces with Color and Texture using Quadric Error Metrics" by Garland and Heckbert. |
Enumerator | |
---|---|
Average | |
Quadric |
|
inline |
|
inlineoverride |
|
inlineprotected |
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
void open3d::geometry::TriangleMesh::ComputeAdjacencyList | ( | ) |
Function to compute adjacency list, call before adjacency list is needed.
void open3d::geometry::TriangleMesh::ComputeTriangleNormals | ( | bool | normalized = true | ) |
Function to compute triangle normals, usually called before rendering.
void open3d::geometry::TriangleMesh::ComputeVertexNormals | ( | bool | normalized = true | ) |
Function to compute vertex normals, usually called before rendering.
int open3d::geometry::TriangleMesh::EulerPoincareCharacteristic | ( | ) | const |
Function that computes the Euler-Poincaré characteristic, i.e., V + F - E, where V is the number of vertices, F is the number of triangles, and E is the number of edges.
void open3d::geometry::TriangleMesh::FilterSharpen | ( | int | number_of_iterations, |
double | strength, | ||
FilterScope | scope = FilterScope::All |
||
) |
Function to sharpen triangle mesh. The output value ($v_o$) is the input value ($v_i$) plus
strength | times the input value minus the sum of he adjacent values. $v_o = v_i x strength (v_i * |N| - {n N} v_n)$. |
number_of_iterations | defines the number of repetitions of this operation. |
void open3d::geometry::TriangleMesh::FilterSmoothLaplacian | ( | int | number_of_iterations, |
double | lambda, | ||
FilterScope | scope = FilterScope::All |
||
) |
Function to smooth triangle mesh using Laplacian. $v_o = v_i (sum_{n N} w_n v_n - v_i)$, with $v_i$ being the input value, $v_o$ the output value, $N$ is the set of adjacent neighbours, $w_n$ is the weighting of the neighbour based on the inverse distance (closer neighbours have higher weight), and
lambda | is the smoothing parameter. |
number_of_iterations | defines the number of repetitions of this operation. |
void open3d::geometry::TriangleMesh::FilterSmoothSimple | ( | int | number_of_iterations, |
FilterScope | scope = FilterScope::All |
||
) |
Function to smooth triangle mesh with simple neighbour average. $v_o = {v_i + {n N} v_n)}{|N| + 1}$, with $v_i$ being the input value, $v_o$ the output value, and $N$ is the set of adjacent neighbours.
number_of_iterations | defines the number of repetitions of this operation. |
void open3d::geometry::TriangleMesh::FilterSmoothTaubin | ( | int | number_of_iterations, |
double | lambda = 0.5 , |
||
double | mu = -0.53 , |
||
FilterScope | scope = FilterScope::All |
||
) |
Function to smooth triangle mesh using method of Taubin, "Curve and Surface Smoothing Without Shrinkage", 1995. Applies in each iteration two times FilterSmoothLaplacian, first with
lambda | and second with |
mu | as smoothing parameter. This method avoids shrinkage of the triangle mesh. |
number_of_iterations | defines the number of repetitions of this operation. |
std::unordered_map< Eigen::Vector2i, std::vector< int >, utility::hash_eigen::hash< Eigen::Vector2i > > open3d::geometry::TriangleMesh::GetEdgeToTrianglesMap | ( | ) | const |
Function that returns a map from edges (vertex0, vertex1) to the triangle indices the given edge belongs to.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
std::vector< Eigen::Vector2i > open3d::geometry::TriangleMesh::GetNonManifoldEdges | ( | bool | allow_boundary_edges = true | ) | const |
Function that returns the non-manifold edges of the triangle mesh. If
allow_boundary_edges | is set to false, than also boundary edges are returned |
std::vector< int > open3d::geometry::TriangleMesh::GetNonManifoldVertices | ( | ) | const |
Function that returns a list of non-manifold vertex indices. A vertex is manifold if its star is edge‐manifold and edge‐connected. (Two or more faces connected only by a vertex and not by an edge.)
std::vector< Eigen::Vector2i > open3d::geometry::TriangleMesh::GetSelfIntersectingTriangles | ( | ) | const |
Function that returns a list of triangles that are intersecting the mesh.
double open3d::geometry::TriangleMesh::GetSurfaceArea | ( | ) | const |
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces.
double open3d::geometry::TriangleMesh::GetSurfaceArea | ( | std::vector< double > & | triangle_areas | ) | const |
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces.
double open3d::geometry::TriangleMesh::GetTriangleArea | ( | size_t | triangle_idx | ) | const |
Function that computes the area of a mesh triangle identified by the triangle index
Eigen::Vector4d open3d::geometry::TriangleMesh::GetTrianglePlane | ( | size_t | triangle_idx | ) | const |
Function that computes the plane equation of a mesh triangle identified by the triangle index.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool open3d::geometry::TriangleMesh::IsBoundingBoxIntersecting | ( | const TriangleMesh & | other | ) | const |
Function that tests if the bounding boxes of the triangle meshes are intersecting.
bool open3d::geometry::TriangleMesh::IsEdgeManifold | ( | bool | allow_boundary_edges = true | ) | const |
Function that checks if the given triangle mesh is edge-manifold. A mesh is edgemanifold if each edge is bounding either one or two triangles. If allow_boundary_edges is set to false, than returns false if there exists boundary edges.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
bool open3d::geometry::TriangleMesh::IsIntersecting | ( | const TriangleMesh & | other | ) | const |
Function that tests if the triangle mesh intersects another triangle mesh. Tests each triangle against each other triangle.
bool open3d::geometry::TriangleMesh::IsOrientable | ( | ) | const |
Function that tests if the given triangle mesh is orientable, i.e. the triangles can oriented in such a way that all normals point towards the outside.
bool open3d::geometry::TriangleMesh::IsSelfIntersecting | ( | ) | const |
Function that tests if the triangle mesh is self-intersecting. Tests each triangle pair for intersection.
bool open3d::geometry::TriangleMesh::IsVertexManifold | ( | ) | const |
Function that checks if all vertices in the triangle mesh are manifold. A vertex is manifold if its star is edge‐manifold and edge‐connected. (Two or more faces connected only by a vertex and not by an edge.)
|
inline |
TriangleMesh open3d::geometry::TriangleMesh::operator+ | ( | const TriangleMesh & | mesh | ) | const |
TriangleMesh & open3d::geometry::TriangleMesh::operator+= | ( | const TriangleMesh & | mesh | ) |
bool open3d::geometry::TriangleMesh::OrientTriangles | ( | ) |
If the mesh is orientable then this functions re-arranges the triangles such that all normals point towards the outside/inside.
|
inline |
Assigns each vertex in the TriangleMesh the same color.
color. |
|
virtual |
Function that removes degenerate triangles, i.e., triangles that references a single vertex multiple times in a single triangle. They are usually the product of removing duplicated vertices.
Reimplemented in open3d::geometry::HalfEdgeTriangleMesh.
|
virtual |
Function that removes duplicated triangles, i.e., removes triangles that reference the same three vertices, independent of their order.
Reimplemented in open3d::geometry::HalfEdgeTriangleMesh.
|
virtual |
Function that removes duplicated verties, i.e., vertices that have identical coordinates.
Reimplemented in open3d::geometry::HalfEdgeTriangleMesh.
|
virtual |
Function that removes all non-manifold edges, by successively deleting triangles with the smallest surface area adjacent to the non-manifold edge until the number of adjacent triangles to the edge is <= 2
.
|
virtual |
This function removes vertices from the triangle mesh that are not referenced in any triangle of the mesh.
Reimplemented in open3d::geometry::HalfEdgeTriangleMesh.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
|
overridevirtual |
Implements open3d::geometry::Geometry3D.
std::vector<std::unordered_set<int> > open3d::geometry::TriangleMesh::adjacency_list_ |
std::vector<Eigen::Vector3d> open3d::geometry::TriangleMesh::triangle_normals_ |
std::vector<Eigen::Vector3i> open3d::geometry::TriangleMesh::triangles_ |
std::vector<Eigen::Vector3d> open3d::geometry::TriangleMesh::vertex_colors_ |
std::vector<Eigen::Vector3d> open3d::geometry::TriangleMesh::vertex_normals_ |
std::vector<Eigen::Vector3d> open3d::geometry::TriangleMesh::vertices_ |