open3d.geometry.TriangleMesh¶
-
class
open3d.geometry.
TriangleMesh
¶ TriangleMesh class. Triangle mesh contains vertices and triangles represented by the indices to the vertices. Optionally, the mesh may also contain triangle normals, vertex normals and vertex colors.
-
class
Type
¶ Enum class for Geometry types.
-
HalfEdgeTriangleMesh
= Type.HalfEdgeTriangleMesh¶
-
Image
= Type.Image¶
-
LineSet
= Type.LineSet¶
-
PointCloud
= Type.PointCloud¶
-
TriangleMesh
= Type.TriangleMesh¶
-
Unspecified
= Type.Unspecified¶
-
VoxelGrid
= Type.VoxelGrid¶
-
-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: open3d.geometry.TriangleMesh) -> None
Default constructor
__init__(self: open3d.geometry.TriangleMesh, arg0: open3d.geometry.TriangleMesh) -> None
Copy constructor
-
clear
(self)¶ Clear all elements in the geometry.
- Returns
None
-
compute_adjacency_list
(self)¶ Function to compute adjacency list, call before adjacency list is needed
- Returns
None
-
compute_triangle_normals
(self, normalized=True)¶ Function to compute triangle normals, usually called before rendering
- Parameters
normalized (bool, optional, default=True) –
- Returns
None
-
compute_vertex_normals
(self, normalized=True)¶ Function to compute vertex normals, usually called before rendering
- Parameters
normalized (bool, optional, default=True) –
- Returns
None
-
dimension
(self)¶ Returns whether the geometry is 2D or 3D.
- Returns
int
-
euler_poincare_characteristic
(self)¶ 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.
- Returns
int
-
filter_sharpen
(self, number_of_iterations=1, strength=1, filter_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 he sum of he adjacent values. \(v_o = v_i x strength (v_i * |N| - \sum_{n \in N} v_n)\)
- Parameters
number_of_iterations (int, optional, default=1) – Number of repetitions of this operation
strength (float, optional, default=1) –
filter_scope (open3d.geometry.FilterScope, optional, default=FilterScope.All) –
- Returns
None
-
filter_smooth_laplacian
(self, number_of_iterations=1, lambda=0.5, filter_scope=FilterScope.All)¶ Function to smooth triangle mesh using Laplacian. \(v_o = v_i \cdot \lambda (sum_{n \in 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.
- Parameters
number_of_iterations (int, optional, default=1) – Number of repetitions of this operation
lambda (float, optional, default=0.5) – Filter parameter.
filter_scope (open3d.geometry.FilterScope, optional, default=FilterScope.All) –
- Returns
None
-
filter_smooth_simple
(self, number_of_iterations=1, filter_scope=FilterScope.All)¶ Function to smooth triangle mesh with simple neighbour average. \(v_o = \frac{v_i + \sum_{n \in 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.
- Parameters
number_of_iterations (int, optional, default=1) – Number of repetitions of this operation
filter_scope (open3d.geometry.FilterScope, optional, default=FilterScope.All) –
- Returns
None
-
filter_smooth_taubin
(self, number_of_iterations=1, lambda=0.5, mu=-0.53, filter_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 filter_smooth_laplacian, first with filter parameter lambda and second with filter parameter mu as smoothing parameter. This method avoids shrinkage of the triangle mesh.
- Parameters
number_of_iterations (int, optional, default=1) – Number of repetitions of this operation
lambda (float, optional, default=0.5) – Filter parameter.
mu (float, optional, default=-0.53) – Filter parameter.
filter_scope (open3d.geometry.FilterScope, optional, default=FilterScope.All) –
- Returns
None
-
get_geometry_type
(self)¶ Returns one of registered geometry types.
- Returns
open3d.geometry.Geometry.GeometryType
-
get_max_bound
(self)¶ Returns max bounds for geometry coordinates.
- Returns
numpy.ndarray[float64[3, 1]]
-
get_min_bound
(self)¶ Returns min bounds for geometry coordinates.
- Returns
numpy.ndarray[float64[3, 1]]
-
get_non_manifold_edges
(self, allow_boundary_edges=True)¶ Get list of non-manifold edges.
- Parameters
allow_boundary_edges (bool, optional, default=True) – If true, than non-manifold edges are defined as edges with more than two adjacent triangles, otherwise each edge that is not adjacent to two triangles is defined as non-manifold.
- Returns
open3d.utility.Vector2iVector
-
get_non_manifold_vertices
(self)¶ Returns a list of indices to non-manifold vertices.
- Returns
open3d.utility.IntVector
-
get_self_intersecting_triangles
(self)¶ Returns a list of indices to triangles that intersect the mesh.
- Returns
open3d.utility.Vector2iVector
-
has_adjacency_list
(self)¶ Returns
True
if the mesh contains adjacency normals.- Returns
bool
-
has_triangle_normals
(self)¶ Returns
True
if the mesh contains triangle normals.- Returns
bool
-
has_triangles
(self)¶ Returns
True
if the mesh contains triangles.- Returns
bool
-
has_vertex_colors
(self)¶ Returns
True
if the mesh contains vertex colors.- Returns
bool
-
has_vertex_normals
(self)¶ Returns
True
if the mesh contains vertex normals.- Returns
bool
-
has_vertices
(self)¶ Returns
True
if the mesh contains vertices.- Returns
bool
-
is_edge_manifold
(self, allow_boundary_edges=True)¶ Tests if the triangle mesh is edge manifold.
- Parameters
allow_boundary_edges (bool, optional, default=True) – If true, than non-manifold edges are defined as edges with more than two adjacent triangles, otherwise each edge that is not adjacent to two triangles is defined as non-manifold.
- Returns
bool
-
is_empty
(self)¶ Returns
True
iff the geometry is empty.- Returns
bool
-
is_intersecting
(self, arg0)¶ Tests the triangle mesh is intersecting the other triangle mesh.
- Parameters
arg0 (open3d.geometry.TriangleMesh) –
- Returns
bool
-
is_orientable
(self)¶ Tests the triangle mesh is orientable
- Returns
bool
-
is_self_intersecting
(self)¶ Tests the triangle mesh is self-intersecting
- Returns
bool
-
is_vertex_manifold
(self)¶ Tests if all vertices of the triangle mesh are manifold.
- Returns
bool
-
normalize_normals
(self)¶ Normalize both triangle normals and vertex normals to legnth 1.
- Returns
None
-
orient_triangles
(self)¶ If the mesh is orientable this function orients all triangles such that all normals point towards the same direction.
- Returns
bool
-
paint_uniform_color
(self, arg0)¶ Assigns each vertex in the TriangleMesh the same color.
- Parameters
arg0 (numpy.ndarray[float64[3, 1]]) –
- Returns
None
-
remove_degenerate_triangles
(self)¶ 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.
- Returns
None
-
remove_duplicated_triangles
(self)¶ Function that removes duplicated triangles, i.e., removes triangles that reference the same three vertices, independent of their order.
- Returns
None
-
remove_duplicated_vertices
(self)¶ Function that removes duplicated verties, i.e., vertices that have identical coordinates.
- Returns
None
-
remove_non_manifold_edges
(self)¶ 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.
- Returns
None
-
remove_unreferenced_vertices
(self)¶ This function removes vertices from the triangle mesh that are not referenced in any triangle of the mesh.
- Returns
None
-
rotate
(self, rotation, center=True, type=RotationType.XYZ)¶ Apply rotation to the geometry coordinates and normals.
- Parameters
rotation (numpy.ndarray[float64[3, 1]]) – A 3D vector that either defines the three angles for Euler rotation, or in the axis-angle representation the normalized vector defines the axis of rotation and the norm the angle around this axis.
center (bool, optional, default=True) – If true, then the rotation is applied to the centered geometry
type (open3d.geometry.RotationType, optional, default=RotationType.XYZ) – Type of rotation, i.e., an Euler format, or axis-angle.
- Returns
open3d.geometry.Geometry3D
-
scale
(self, scale, center=True)¶ Apply scaling to the geometry coordinates.
- Parameters
scale (float) – The scale parameter that is multiplied to the points/vertices of the geometry
center (bool, optional, default=True) – If true, then the scale is applied to the centered geometry
- Returns
open3d.geometry.Geometry3D
-
transform
(self, arg0)¶ Apply transformation (4x4 matrix) to the geometry coordinates.
- Parameters
arg0 (numpy.ndarray[float64[4, 4]]) –
- Returns
open3d.geometry.Geometry3D
-
translate
(self, arg0)¶ Apply translation to the geometry coordinates.
- Parameters
arg0 (numpy.ndarray[float64[3, 1]]) –
- Returns
open3d.geometry.Geometry3D
-
HalfEdgeTriangleMesh
= Type.HalfEdgeTriangleMesh¶
-
Image
= Type.Image¶
-
LineSet
= Type.LineSet¶
-
PointCloud
= Type.PointCloud¶
-
TriangleMesh
= Type.TriangleMesh¶
-
Unspecified
= Type.Unspecified¶
-
VoxelGrid
= Type.VoxelGrid¶
-
property
adjacency_list
¶ The set
adjacency_list[i]
contains the indices of adjacent vertices of vertex i.- Type
List of Sets
-
property
triangle_normals
¶ Triangle normals.
- Type
float64
array of shape(num_triangles, 3)
, usenumpy.asarray()
to access data
-
property
triangles
¶ List of triangles denoted by the index of points forming the triangle.
- Type
int
array of shape(num_triangles, 3)
, usenumpy.asarray()
to access data
-
property
vertex_colors
¶ RGB colors of vertices.
- Type
float64
array of shape(num_vertices, 3)
, range[0, 1]
, usenumpy.asarray()
to access data
-
property
vertex_normals
¶ Vertex normals.
- Type
float64
array of shape(num_vertices, 3)
, usenumpy.asarray()
to access data
-
property
vertices
¶ Vertex coordinates.
- Type
float64
array of shape(num_vertices, 3)
, usenumpy.asarray()
to access data
-
class