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
RGBDImage = Type.RGBDImage
TetraMesh = Type.TetraMesh
TriangleMesh = Type.TriangleMesh
Unspecified = Type.Unspecified
VoxelGrid = Type.VoxelGrid
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: open3d.geometry.TriangleMesh) -> None

Default constructor

  1. __init__(self: open3d.geometry.TriangleMesh, arg0: open3d.geometry.TriangleMesh) -> None

Copy constructor

clear(self)

Clear all elements in the geometry.

Returns

open3d.geometry.Geometry

compute_adjacency_list(self)

Function to compute adjacency list, call before adjacency list is needed

Returns

open3d.geometry.TriangleMesh

compute_convex_hull(self)

Computes the convex hull of the triangle mesh.

Returns

open3d.geometry.TriangleMesh

compute_triangle_normals(self, normalized=True)

Function to compute triangle normals, usually called before rendering

Parameters

normalized (bool, optional, default=True) –

Returns

open3d.geometry.TriangleMesh

compute_vertex_normals(self, normalized=True)

Function to compute vertex normals, usually called before rendering

Parameters

normalized (bool, optional, default=True) –

Returns

open3d.geometry.TriangleMesh

static create_arrow(cylinder_radius=1.0, cone_radius=1.5, cylinder_height=5.0, cone_height=4.0, resolution=20, cylinder_split=4, cone_split=1)

Factory function to create an arrow mesh

Parameters
  • cylinder_radius (float, optional, default=1.0) – The radius of the cylinder.

  • cone_radius (float, optional, default=1.5) – The radius of the cone.

  • cylinder_height (float, optional, default=5.0) – The height of the cylinder. The cylinder is from (0, 0, 0) to (0, 0, cylinder_height)

  • cone_height (float, optional, default=4.0) – The height of the cone. The axis of the cone will be from (0, 0, cylinder_height) to (0, 0, cylinder_height + cone_height)

  • resolution (int, optional, default=20) – The cone will be split into resolution segments.

  • cylinder_split (int, optional, default=4) – The cylinder_height will be split into cylinder_split segments.

  • cone_split (int, optional, default=1) – The cone_height will be split into cone_split segments.

Returns

open3d.geometry.TriangleMesh

static create_box(width=1.0, height=1.0, depth=1.0)

Factory function to create a box. The left bottom corner on the front will be placed at (0, 0, 0).

Parameters
  • width (float, optional, default=1.0) – x-directional length.

  • height (float, optional, default=1.0) – y-directional length.

  • depth (float, optional, default=1.0) – z-directional length.

Returns

open3d.geometry.TriangleMesh

static create_cone(radius=1.0, height=2.0, resolution=20, split=1)

Factory function to create a cone mesh.

Parameters
  • radius (float, optional, default=1.0) – The radius of the cone.

  • height (float, optional, default=2.0) – The height of the cone. The axis of the cone will be from (0, 0, 0) to (0, 0, height).

  • resolution (int, optional, default=20) – The circle will be split into resolution segments

  • split (int, optional, default=1) – The height will be split into split segments.

Returns

open3d.geometry.TriangleMesh

static create_coordinate_frame(size=1.0, origin=array([0., 0., 0.]))

Factory function to create a coordinate frame mesh. The coordinate frame will be centered at origin. The x, y, z axis will be rendered as red, green, and blue arrows respectively.

Parameters
  • size (float, optional, default=1.0) – The size of the coordinate frame.

  • origin (numpy.ndarray[float64[3, 1]], optional, default=array([0., 0., 0.])) – The origin of the cooridnate frame.

Returns

open3d.geometry.TriangleMesh

static create_cylinder(radius=1.0, height=2.0, resolution=20, split=4)

Factory function to create a cylinder mesh.

Parameters
  • radius (float, optional, default=1.0) – The radius of the cylinder.

  • height (float, optional, default=2.0) – The height of the cylinder. The axis of the cylinder will be from (0, 0, -height/2) to (0, 0, height/2).

  • resolution (int, optional, default=20) – The circle will be split into resolution segments

  • split (int, optional, default=4) – The height will be split into split segments.

Returns

open3d.geometry.TriangleMesh

static create_from_point_cloud_ball_pivoting(pcd, radii)

Function that computes a triangle mesh from a oriented PointCloud. This implements the Ball Pivoting algorithm proposed in F. Bernardini et al., “The ball-pivoting algorithm for surface reconstruction”, 1999. The implementation is also based on the algorithms outlined in Digne, “An Analysis and Implementation of a Parallel Ball Pivoting Algorithm”, 2014. The surface reconstruction is done by rolling a ball with a given radius over the point cloud, whenever the ball touches three points a triangle is created.

Parameters
Returns

open3d.geometry.TriangleMesh

static create_icosahedron(radius=1.0)

Factory function to create a icosahedron. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.

Parameters

radius (float, optional, default=1.0) – Distance from centroid to mesh vetices.

Returns

open3d.geometry.TriangleMesh

static create_moebius(length_split=70, width_split=15, twists=1, raidus=1, flatness=1, width=1, scale=1)

Factory function to create a Moebius strip.

Parameters
  • length_split (int, optional, default=70) – The number of segments along the Moebius strip.

  • width_split (int, optional, default=15) – The number of segments along the width of the Moebius strip.

  • twists (int, optional, default=1) – Number of twists of the Moebius strip.

  • raidus (float, optional, default=1) –

  • flatness (float, optional, default=1) – Controls the flatness/height of the Moebius strip.

  • width (float, optional, default=1) – Width of the Moebius strip.

  • scale (float, optional, default=1) – Scale the complete Moebius strip.

Returns

open3d.geometry.TriangleMesh

static create_octahedron(radius=1.0)

Factory function to create a octahedron. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.

Parameters

radius (float, optional, default=1.0) – Distance from centroid to mesh vetices.

Returns

open3d.geometry.TriangleMesh

static create_sphere(radius=1.0, resolution=20)

Factory function to create a sphere mesh centered at (0, 0, 0).

Parameters
  • radius (float, optional, default=1.0) – The radius of the sphere.

  • resolution (int, optional, default=20) – The resolution of the sphere. The longitues will be split into resolution segments (i.e. there are resolution + 1 latitude lines including the north and south pole). The latitudes will be split into `2 * resolution segments (i.e. there are 2 * resolution longitude lines.)

Returns

open3d.geometry.TriangleMesh

static create_tetrahedron(radius=1.0)

Factory function to create a tetrahedron. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.

Parameters

radius (float, optional, default=1.0) – Distance from centroid to mesh vetices.

Returns

open3d.geometry.TriangleMesh

static create_torus(torus_radius=1.0, tube_radius=0.5, radial_resolution=30, tubular_resolution=20)

Factory function to create a torus mesh.

Parameters
  • torus_radius (float, optional, default=1.0) – The radius from the center of the torus to the center of the tube.

  • tube_radius (float, optional, default=0.5) – The radius of the torus tube.

  • radial_resolution (int, optional, default=30) – The number of segments along the radial direction.

  • tubular_resolution (int, optional, default=20) – The number of segments along the tubular direction.

Returns

open3d.geometry.TriangleMesh

crop(self, min_bound, max_bound)

Function to crop input triangle mesh into output triangle mesh

Parameters
  • min_bound (numpy.ndarray[float64[3, 1]]) – Minimum bound for vertex coordinate.

  • max_bound (numpy.ndarray[float64[3, 1]]) – Maximum bound for vertex coordinate.

Returns

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

get_axis_aligned_bounding_box(self)

Returns an axis-aligned bounding box of the geometry.

Returns

open3d.geometry.AxisAlignedBoundingBox

get_center(self)

Returns the center of the geometry coordinates.

Returns

numpy.ndarray[float64[3, 1]]

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_oriented_bounding_box(self)

Returns an oriented bounding box of the geometry.

Returns

open3d.geometry.OrientedBoundingBox

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 if the triangle mesh is intersecting the other triangle mesh.

Parameters

arg0 (open3d.geometry.TriangleMesh) –

Returns

bool

is_orientable(self)

Tests if the triangle mesh is orientable.

Returns

bool

is_self_intersecting(self)

Tests if the triangle mesh is self-intersecting.

Returns

bool

is_vertex_manifold(self)

Tests if all vertices of the triangle mesh are manifold.

Returns

bool

is_watertight(self)

Tests if the triangle mesh is watertight.

Returns

bool

normalize_normals(self)

Normalize both triangle normals and vertex normals to legnth 1.

Returns

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

remove_duplicated_triangles(self)

Function that removes duplicated triangles, i.e., removes triangles that reference the same three vertices, independent of their order.

Returns

open3d.geometry.TriangleMesh

remove_duplicated_vertices(self)

Function that removes duplicated verties, i.e., vertices that have identical coordinates.

Returns

open3d.geometry.TriangleMesh

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

open3d.geometry.TriangleMesh

remove_unreferenced_vertices(self)

This function removes vertices from the triangle mesh that are not referenced in any triangle of the mesh.

Returns

open3d.geometry.TriangleMesh

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

sample_points_poisson_disk(self, number_of_points, init_factor=5, pcl=None)

Function to sample points from the mesh, where each point has approximately the same distance to the neighbouring points (blue noise). Method is based on Yuksel, “Sample Elimination for Generating Poisson Disk Sample Sets”, EUROGRAPHICS, 2015.

Parameters
  • number_of_points (int) – Number of points that should be sampled.

  • init_factor (float, optional, default=5) – Factor for the initial uniformly sampled PointCloud. This init PointCloud is used for sample elimination.

  • pcl (open3d.geometry.PointCloud, optional, default=None) – Initial PointCloud that is used for sample elimination. If this parameter is provided the init_factor is ignored.

Returns

open3d.geometry.PointCloud

sample_points_uniformly(self, number_of_points=100)

Function to uniformly sample points from the mesh.

Parameters

number_of_points (int, optional, default=100) – Number of points that should be uniformly sampled.

Returns

open3d.geometry.PointCloud

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

select_down_sample(self, indices)

Function to select mesh from input triangle mesh into output triangle mesh. input: The input triangle mesh. indices: Indices of vertices to be selected.

Parameters

indices (List[int]) – Indices of vertices to be selected.

Returns

open3d.geometry.TriangleMesh

simplify_quadric_decimation(self, target_number_of_triangles)

Function to simplify mesh using Quadric Error Metric Decimation by Garland and Heckbert

Parameters

target_number_of_triangles (int) – The number of triangles that the simplified mesh should have. It is not guranteed that this number will be reached.

Returns

open3d.geometry.TriangleMesh

simplify_vertex_clustering(self, voxel_size, contraction=SimplificationContraction.Average)

Function to simplify mesh using vertex clustering.

Parameters
  • voxel_size (float) – The size of the voxel within vertices are pooled.

  • contraction (open3d.geometry.SimplificationContraction, optional, default=SimplificationContraction.Average) – Method to aggregate vertex information. Average computes a simple average, Quadric minimizes the distance to the adjacent planes.

Returns

open3d.geometry.TriangleMesh

subdivide_loop(self, number_of_iterations=1)

Function subdivide mesh using Loop’s algorithm. Loop, “Smooth subdivision surfaces based on triangles”, 1987.

Parameters

number_of_iterations (int, optional, default=1) – Number of iterations. A single iteration splits each triangle into four triangles.

Returns

open3d.geometry.TriangleMesh

subdivide_midpoint(self, number_of_iterations=1)

Function subdivide mesh using midpoint algorithm.

Parameters

number_of_iterations (int, optional, default=1) – Number of iterations. A single iteration splits each triangle into four triangles that cover the same surface.

Returns

open3d.geometry.TriangleMesh

transform(self, arg0)

Apply transformation (4x4 matrix) to the geometry coordinates.

Parameters

arg0 (numpy.ndarray[float64[4, 4]]) –

Returns

open3d.geometry.Geometry3D

translate(self, translation, relative=True)

Apply translation to the geometry coordinates.

Parameters
  • translation (numpy.ndarray[float64[3, 1]]) – A 3D vector to transform the geometry

  • relative (bool, optional, default=True) – If true, the translation vector is directly added to the geometry coordinates. Otherwise, the center is moved to the translation vector.

Returns

open3d.geometry.Geometry3D

HalfEdgeTriangleMesh = Type.HalfEdgeTriangleMesh
Image = Type.Image
LineSet = Type.LineSet
PointCloud = Type.PointCloud
RGBDImage = Type.RGBDImage
TetraMesh = Type.TetraMesh
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), use numpy.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), use numpy.asarray() to access data

property vertex_colors

RGB colors of vertices.

Type

float64 array of shape (num_vertices, 3), range [0, 1] , use numpy.asarray() to access data

property vertex_normals

Vertex normals.

Type

float64 array of shape (num_vertices, 3), use numpy.asarray() to access data

property vertices

Vertex coordinates.

Type

float64 array of shape (num_vertices, 3), use numpy.asarray() to access data