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: 7>#
- Image = <Type.Image: 8>#
- LineSet = <Type.LineSet: 4>#
- PointCloud = <Type.PointCloud: 1>#
- RGBDImage = <Type.RGBDImage: 9>#
- TetraMesh = <Type.TetraMesh: 10>#
- TriangleMesh = <Type.TriangleMesh: 6>#
- Unspecified = <Type.Unspecified: 0>#
- VoxelGrid = <Type.VoxelGrid: 2>#
- property name#
- property value#
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: open3d.cpu.pybind.geometry.TriangleMesh) -> None
Default constructor
__init__(self: open3d.cpu.pybind.geometry.TriangleMesh, arg0: open3d.cpu.pybind.geometry.TriangleMesh) -> None
Copy constructor
__init__(self: open3d.cpu.pybind.geometry.TriangleMesh, vertices: open3d.cpu.pybind.utility.Vector3dVector, triangles: open3d.cpu.pybind.utility.Vector3iVector) -> None
Create a triangle mesh from vertices and triangle indices
- clear(self)#
Clear all elements in the geometry.
- Returns:
open3d.geometry.Geometry
- cluster_connected_triangles(self)#
Function that clusters connected triangles, i.e., triangles that are connected via edges are assigned the same cluster index. This function returns an array that contains the cluster index per triangle, a second array contains the number of triangles per cluster, and a third vector contains the surface area per cluster.
- Returns:
tuple[open3d.utility.IntVector, list[int], open3d.utility.DoubleVector]
- 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:
tuple[open3d.geometry.TriangleMesh, list[int]]
- 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 intocylinder_split
segments.cone_split (int, optional, default=1) – The
cone_height
will be split intocone_split
segments.
- Returns:
open3d.geometry.TriangleMesh
- static create_box(width=1.0, height=1.0, depth=1.0, create_uv_map=False, map_texture_to_each_face=False)#
Factory function to create a box. The left bottom corner on the front will be placed at (0, 0, 0), and default UV map, maps the entire texture to each face.
- 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.
create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
map_texture_to_each_face (bool, optional, default=False) – Map entire texture to each face.
- Returns:
open3d.geometry.TriangleMesh
- static create_cone(radius=1.0, height=2.0, resolution=20, split=1, create_uv_map=False)#
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
segmentssplit (int, optional, default=1) – The
height
will be split intosplit
segments.create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- 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[numpy.float64[3, 1]], optional, default=array([0., 0., 0.])) – The origin of the coordinate frame.
- Returns:
open3d.geometry.TriangleMesh
- static create_cylinder(radius=1.0, height=2.0, resolution=20, split=4, create_uv_map=False)#
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
segmentssplit (int, optional, default=4) – The
height
will be split intosplit
segments.create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- Returns:
open3d.geometry.TriangleMesh
- static create_from_oriented_bounding_box(obox, scale=array([1., 1., 1.]), create_uv_map=False)#
Factory function to create a solid oriented bounding box.
- Parameters:
obox (open3d.geometry.OrientedBoundingBox) – OrientedBoundingBox object to create mesh of.
scale (numpy.ndarray[numpy.float64[3, 1]], optional, default=array([1., 1., 1.])) – scale factor along each direction of OrientedBoundingBox
create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- Returns:
open3d.geometry.TriangleMesh
- static create_from_point_cloud_alpha_shape(*args, **kwargs)#
Overloaded function.
- create_from_point_cloud_alpha_shape(pcd, alpha)
Alpha shapes are a generalization of the convex hull. With decreasing alpha value the shape schrinks and creates cavities. See Edelsbrunner and Muecke, “Three-Dimensional Alpha Shapes”, 1994.
- Parameters:
pcd (open3d.geometry.PointCloud) – PointCloud from which the TriangleMesh surface is reconstructed.
alpha (float) – Parameter to control the shape. A very big value will give a shape close to the convex hull.
- Returns:
open3d.geometry.TriangleMesh
- create_from_point_cloud_alpha_shape(pcd, alpha, tetra_mesh, pt_map)
Alpha shapes are a generalization of the convex hull. With decreasing alpha value the shape shrinks and creates cavities. See Edelsbrunner and Muecke, “Three-Dimensional Alpha Shapes”, 1994.
- Parameters:
pcd (open3d.geometry.PointCloud) – PointCloud from which the TriangleMesh surface is reconstructed.
alpha (float) – Parameter to control the shape. A very big value will give a shape close to the convex hull.
tetra_mesh (open3d.geometry.TetraMesh) – If not None, than uses this to construct the alpha shape. Otherwise, TetraMesh is computed from pcd.
pt_map (list[int]) – Optional map from tetra_mesh vertex indices to pcd points.
- 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:
pcd (open3d.geometry.PointCloud) – PointCloud from which the TriangleMesh surface is reconstructed. Has to contain normals.
radii (open3d.utility.DoubleVector) – The radii of the ball that are used for the surface reconstruction.
- Returns:
open3d.geometry.TriangleMesh
- static create_from_point_cloud_poisson(pcd, depth=8, width=0, scale=1.1, linear_fit=False, n_threads=-1)#
Function that computes a triangle mesh from a oriented PointCloud pcd. This implements the Screened Poisson Reconstruction proposed in Kazhdan and Hoppe, “Screened Poisson Surface Reconstruction”, 2013. This function uses the original implementation by Kazhdan. See https://github.com/mkazhdan/PoissonRecon
- Parameters:
pcd (open3d.geometry.PointCloud) – PointCloud from which the TriangleMesh surface is reconstructed. Has to contain normals.
depth (int, optional, default=8) – Maximum depth of the tree that will be used for surface reconstruction. Running at depth d corresponds to solving on a grid whose resolution is no larger than 2^d x 2^d x 2^d. Note that since the reconstructor adapts the octree to the sampling density, the specified reconstruction depth is only an upper bound.
width (float, optional, default=0) – Specifies the target width of the finest level octree cells. This parameter is ignored if depth is specified
scale (float, optional, default=1.1) – Specifies the ratio between the diameter of the cube used for reconstruction and the diameter of the samples’ bounding cube.
linear_fit (bool, optional, default=False) – If true, the reconstructor will use linear interpolation to estimate the positions of iso-vertices.
n_threads (int, optional, default=-1) – Number of threads used for reconstruction. Set to -1 to automatically determine it.
- Returns:
tuple[open3d.geometry.TriangleMesh, open3d.utility.DoubleVector]
- static create_icosahedron(radius=1.0, create_uv_map=False)#
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.
create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- Returns:
open3d.geometry.TriangleMesh
- static create_mobius(length_split=70, width_split=15, twists=1, raidus=1, flatness=1, width=1, scale=1)#
Factory function to create a Mobius strip.
- Parameters:
length_split (int, optional, default=70) – The number of segments along the Mobius strip.
width_split (int, optional, default=15) – The number of segments along the width of the Mobius strip.
twists (int, optional, default=1) – Number of twists of the Mobius strip.
raidus (float, optional, default=1) –
flatness (float, optional, default=1) – Controls the flatness/height of the Mobius strip.
width (float, optional, default=1) – Width of the Mobius strip.
scale (float, optional, default=1) – Scale the complete Mobius strip.
- Returns:
open3d.geometry.TriangleMesh
- static create_octahedron(radius=1.0, create_uv_map=False)#
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.
create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- Returns:
open3d.geometry.TriangleMesh
- static create_sphere(radius=1.0, resolution=20, create_uv_map=False)#
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 areresolution + 1
latitude lines including the north and south pole). The latitudes will be split into`2 * resolution
segments (i.e. there are2 * resolution
longitude lines.)create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- Returns:
open3d.geometry.TriangleMesh
- static create_tetrahedron(radius=1.0, create_uv_map=False)#
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.
create_uv_map (bool, optional, default=False) – Add default uv map to the mesh.
- 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(*args, **kwargs)#
Overloaded function.
- crop(self, bounding_box)
Function to crop input TriangleMesh into output TriangleMesh
- Parameters:
bounding_box (open3d.geometry.AxisAlignedBoundingBox) – AxisAlignedBoundingBox to crop points
- Returns:
open3d.geometry.TriangleMesh
- crop(self, bounding_box)
Function to crop input TriangleMesh into output TriangleMesh
- Parameters:
bounding_box (open3d.geometry.OrientedBoundingBox) – AxisAlignedBoundingBox to crop points
- Returns:
open3d.geometry.TriangleMesh
- deform_as_rigid_as_possible(self, constraint_vertex_indices, constraint_vertex_positions, max_iter, energy=<DeformAsRigidAsPossibleEnergy.Spokes: 0>, smoothed_alpha=0.01)#
This function deforms the mesh using the method by Sorkine and Alexa, ‘As-Rigid-As-Possible Surface Modeling’, 2007
- Parameters:
constraint_vertex_indices (open3d.utility.IntVector) – Indices of the triangle vertices that should be constrained by the vertex positions in constraint_vertex_positions.
constraint_vertex_positions (open3d.utility.Vector3dVector) – Vertex positions used for the constraints.
max_iter (int) – Maximum number of iterations to minimize energy functional.
(open3d.geometry.DeformAsRigidAsPossibleEnergy (energy) – 0>): Energy model that is minimized in the deformation process
optional – 0>): Energy model that is minimized in the deformation process
default=<DeformAsRigidAsPossibleEnergy.Spokes – 0>): Energy model that is minimized in the deformation process
smoothed_alpha (float, optional, default=0.01) – trade-off parameter for the smoothed energy functional for the regularization term.
- 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: 0>)#
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 parameter.
(open3d.geometry.FilterScope (filter_scope) – 0>)
optional – 0>)
default=<FilterScope.All – 0>)
- Returns:
open3d.geometry.TriangleMesh
- filter_smooth_laplacian(self, number_of_iterations=1, lambda_filter=0.5, filter_scope=<FilterScope.All: 0>)#
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_filter is the smoothing parameter.
- Parameters:
number_of_iterations (int, optional, default=1) – Number of repetitions of this operation
lambda_filter (float, optional, default=0.5) – Filter parameter.
(open3d.geometry.FilterScope (filter_scope) – 0>)
optional – 0>)
default=<FilterScope.All – 0>)
- Returns:
open3d.geometry.TriangleMesh
- filter_smooth_simple(self, number_of_iterations=1, filter_scope=<FilterScope.All: 0>)#
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
(open3d.geometry.FilterScope (filter_scope) – 0>)
optional – 0>)
default=<FilterScope.All – 0>)
- Returns:
open3d.geometry.TriangleMesh
- filter_smooth_taubin(self, number_of_iterations=1, lambda_filter=0.5, mu=-0.53, filter_scope=<FilterScope.All: 0>)#
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_filter 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_filter (float, optional, default=0.5) – Filter parameter.
mu (float, optional, default=-0.53) – Filter parameter.
(open3d.geometry.FilterScope (filter_scope) – 0>)
optional – 0>)
default=<FilterScope.All – 0>)
- 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[numpy.float64[3, 1]]
- get_geometry_type(self)#
Returns one of registered geometry types.
- Returns:
open3d.geometry.Geometry.Type
- get_max_bound(self)#
Returns max bounds for geometry coordinates.
- Returns:
numpy.ndarray[numpy.float64[3, 1]]
- get_min_bound(self)#
Returns min bounds for geometry coordinates.
- Returns:
numpy.ndarray[numpy.float64[3, 1]]
- get_minimal_oriented_bounding_box(self: open3d.cpu.pybind.geometry.Geometry3D, robust: bool = False) open3d.cpu.pybind.geometry.OrientedBoundingBox #
Returns the minimal oriented bounding box for the geometry.
Creates the oriented bounding box with the smallest volume. The algorithm makes use of the fact that at least one edge of the convex hull must be collinear with an edge of the minimum bounding box: for each triangle in the convex hull, calculate the minimal axis aligned box in the frame of that triangle. at the end, return the box with the smallest volume
- Parameters:
robust (bool) – If set to true uses a more robust method which works in degenerate cases but introduces noise to the points coordinates.
- Returns:
The oriented bounding box. The bounding box is oriented such that its volume is minimized.
- Return type:
- 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: open3d.cpu.pybind.geometry.Geometry3D, robust: bool = False) open3d.cpu.pybind.geometry.OrientedBoundingBox #
Returns the oriented bounding box for the geometry.
Computes the oriented bounding box based on the PCA of the convex hull. The returned bounding box is an approximation to the minimal bounding box.
- Parameters:
robust (bool) – If set to true uses a more robust method which works in degenerate cases but introduces noise to the points coordinates.
- Returns:
The oriented bounding box. The bounding box is oriented such that the axes are ordered with respect to the principal components.
- Return type:
- static get_rotation_matrix_from_axis_angle(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_quaternion(rotation: numpy.ndarray[numpy.float64[4, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_xyz(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_xzy(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_yxz(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_yzx(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_zxy(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- static get_rotation_matrix_from_zyx(rotation: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[3, 3]] #
- get_self_intersecting_triangles(self)#
Returns a list of indices to triangles that intersect the mesh.
- Returns:
open3d.utility.Vector2iVector
- get_surface_area(self: open3d.cpu.pybind.geometry.TriangleMesh) float #
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces.
- get_volume(self: open3d.cpu.pybind.geometry.TriangleMesh) float #
Function that computes the volume of the mesh, under the condition that it is watertight and orientable.
- has_adjacency_list(self)#
Returns
True
if the mesh contains adjacency normals.- Returns:
bool
- has_textures(self)#
Returns
True
if the mesh contains a texture image.- Returns:
bool
- has_triangle_material_ids(self)#
Returns
True
if the mesh contains material ids.- Returns:
bool
- has_triangle_normals(self)#
Returns
True
if the mesh contains triangle normals.- Returns:
bool
- has_triangle_uvs(self)#
Returns
True
if the mesh contains uv coordinates.- 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
- merge_close_vertices(self, eps)#
Function that will merge close by vertices to a single one. The vertex position, normal and color will be the average of the vertices. The parameter eps defines the maximum distance of close by vertices. This function might help to close triangle soups.
- Parameters:
eps (float) – Parameter that defines the distance between close vertices.
- Returns:
open3d.geometry.TriangleMesh
- normalize_normals(self)#
Normalize both triangle normals and vertex normals to length 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[numpy.float64[3, 1]]) –
- Returns:
open3d.geometry.MeshBase
- 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 and have the same orientation.
- Returns:
open3d.geometry.TriangleMesh
- remove_duplicated_vertices(self)#
Function that removes duplicated vertices, 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_triangles_by_index(self, triangle_indices)#
This function removes the triangles with index in triangle_indices. Call remove_unreferenced_vertices to clean up vertices afterwards.
- Parameters:
triangle_indices (list[int]) – 1D array of triangle indices that should be removed from the TriangleMesh.
- Returns:
None
- remove_triangles_by_mask(self, triangle_mask)#
This function removes the triangles where triangle_mask is set to true. Call remove_unreferenced_vertices to clean up vertices afterwards.
- Parameters:
triangle_mask (list[bool]) – 1D bool array, True values indicate triangles that should be removed.
- 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:
open3d.geometry.TriangleMesh
- remove_vertices_by_index(self, vertex_indices)#
This function removes the vertices with index in vertex_indices. Note that also all triangles associated with the vertices are removed.
- Parameters:
vertex_indices (list[int]) – 1D array of vertex indices that should be removed from the TriangleMesh.
- Returns:
None
- remove_vertices_by_mask(self, vertex_mask)#
This function removes the vertices that are masked in vertex_mask. Note that also all triangles associated with the vertices are removed.
- Parameters:
vertex_mask (list[bool]) – 1D bool array, True values indicate vertices that should be removed.
- Returns:
None
- rotate(*args, **kwargs)#
Overloaded function.
- rotate(self, R)
Apply rotation to the geometry coordinates and normals.
- Parameters:
R (numpy.ndarray[numpy.float64[3, 3]]) – The rotation matrix
- Returns:
open3d.geometry.Geometry3D
- rotate(self, R, center)
Apply rotation to the geometry coordinates and normals.
- Parameters:
R (numpy.ndarray[numpy.float64[3, 3]]) – The rotation matrix
center (numpy.ndarray[numpy.float64[3, 1]]) – Rotation center used for transformation.
- Returns:
open3d.geometry.Geometry3D
- sample_points_poisson_disk(self, number_of_points, init_factor=5, pcl=None, use_triangle_normal=False)#
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.
use_triangle_normal (bool, optional, default=False) – If True assigns the triangle normals instead of the interpolated vertex normals to the returned points. The triangle normals will be computed and added to the mesh if necessary.
- Returns:
open3d.geometry.PointCloud
- sample_points_uniformly(self, number_of_points=100, use_triangle_normal=False)#
Function to uniformly sample points from the mesh.
- Parameters:
number_of_points (int, optional, default=100) – Number of points that should be uniformly sampled.
use_triangle_normal (bool, optional, default=False) – If True assigns the triangle normals instead of the interpolated vertex normals to the returned points. The triangle normals will be computed and added to the mesh if necessary.
- Returns:
open3d.geometry.PointCloud
- scale(*args, **kwargs)#
Overloaded function.
- scale(self, scale, center)
Apply scaling to the geometry coordinates.
- Parameters:
scale (float) – The scale parameter that is multiplied to the points/vertices of the geometry.
center (numpy.ndarray[numpy.float64[3, 1]]) – Scale center used for transformation.
- Returns:
open3d.geometry.Geometry3D
- scale(self, scale, center)
Apply scaling to the geometry coordinates.
- Parameters:
scale (float) – The scale parameter that is multiplied to the points/vertices of the geometry.
center (numpy.ndarray[numpy.float64[3, 1]]) – Scale center used for transformation.
- Returns:
open3d.geometry.Geometry3D
- select_by_index(self, indices, cleanup=True)#
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.
cleanup (bool, optional, default=True) – If true calls number of mesh cleanup functions to remove unreferenced vertices and degenerate triangles
- Returns:
open3d.geometry.TriangleMesh
- simplify_quadric_decimation(self, target_number_of_triangles, maximum_error=inf, boundary_weight=1.0)#
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 guaranteed that this number will be reached.
maximum_error (float, optional, default=inf) – The maximum error where a vertex is allowed to be merged
boundary_weight (float, optional, default=1.0) – A weight applied to edge vertices used to preserve boundaries
- Returns:
open3d.geometry.TriangleMesh
- simplify_vertex_clustering(self, voxel_size, contraction=<SimplificationContraction.Average: 0>)#
Function to simplify mesh using vertex clustering.
- Parameters:
voxel_size (float) – The size of the voxel within vertices are pooled.
(open3d.geometry.SimplificationContraction (contraction) – 0>): Method to aggregate vertex information. Average computes a simple average, Quadric minimizes the distance to the adjacent planes.
optional – 0>): Method to aggregate vertex information. Average computes a simple average, Quadric minimizes the distance to the adjacent planes.
default=<SimplificationContraction.Average – 0>): 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[numpy.float64[4, 4]]) –
- Returns:
open3d.geometry.Geometry3D
- translate(self, translation, relative=True)#
Apply translation to the geometry coordinates.
- Parameters:
translation (numpy.ndarray[numpy.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: 7>#
- Image = <Type.Image: 8>#
- LineSet = <Type.LineSet: 4>#
- PointCloud = <Type.PointCloud: 1>#
- RGBDImage = <Type.RGBDImage: 9>#
- TetraMesh = <Type.TetraMesh: 10>#
- TriangleMesh = <Type.TriangleMesh: 6>#
- Unspecified = <Type.Unspecified: 0>#
- VoxelGrid = <Type.VoxelGrid: 2>#
- property adjacency_list#
The set
adjacency_list[i]
contains the indices of adjacent vertices of vertex i.- Type:
List of Sets
- property textures#
The texture images.
- Type:
- property triangle_material_ids#
material index associated with each triangle
- Type:
int array of shape
(num_trianges, 1)
, usenumpy.asarray()
to access data
- property triangle_normals#
Triangle normals.
- Type:
float64
array of shape(num_triangles, 3)
, usenumpy.asarray()
to access data
- property triangle_uvs#
List of uvs denoted by the index of points forming the triangle.
- Type:
float64
array of shape(3 * num_triangles, 2)
, 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