open3d.geometry.Octree#

class open3d.geometry.Octree#

Octree datastructure.

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 value#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self)

    Default constructor

  2. __init__(self, arg0)

    Copy constructor

Parameters:

arg0 (open3d.geometry.Octree) –

  1. __init__(self, max_depth)

Parameters:

max_depth (int) –

  1. __init__(self, max_depth, origin, size)

Parameters:
  • max_depth (int) –

  • origin (numpy.ndarray[numpy.float64[3, 1]]) –

  • size (float) –

clear(self)#

Clear all elements in the geometry.

Returns:

open3d.geometry.Geometry

convert_from_point_cloud(self, point_cloud, size_expand=0.01)#

Convert octree from point cloud.

Parameters:
  • point_cloud (open3d.geometry.PointCloud) – Input point cloud.

  • size_expand (float, optional, default=0.01) – A small expansion size such that the octree is slightly bigger than the original point cloud bounds to accommodate all points.

Returns:

None

create_from_voxel_grid(self)#
Returns:

None

dimension(self)#

Returns whether the geometry is 2D or 3D.

Returns:

int

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.GeometryType

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::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:

open3d.geometry.OrientedBoundingBox

get_oriented_bounding_box(self: open3d.cpu.pybind.geometry.Geometry3D, robust: bool = False) open3d::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:

open3d.geometry.OrientedBoundingBox

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]]#
insert_point(self, point, f_init, f_update, fi_init=None, fi_update=None)#

Insert a point to the octree.

Parameters:
Returns:

None

is_empty(self)#

Returns True iff the geometry is empty.

Returns:

bool

static is_point_in_bound(point, origin, size)#

Return true if point within bound, that is, origin<= point < origin + size

Parameters:
  • point (numpy.ndarray[numpy.float64[3, 1]]) – Coordinates of the point.

  • origin (numpy.ndarray[numpy.float64[3, 1]]) – Origin coordinates.

  • size (float) – Size of the Octree.

Returns:

bool

locate_leaf_node(self, point)#

Returns leaf OctreeNode and OctreeNodeInfo where the querypoint should reside.

Parameters:

point (numpy.ndarray[numpy.float64[3, 1]]) – Coordinates of the point.

Returns:

Tuple[open3d.geometry.OctreeLeafNode, open3d.geometry.OctreeNodeInfo]

rotate(*args, **kwargs)#

Overloaded function.

  1. 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

  1. 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

scale(*args, **kwargs)#

Overloaded function.

  1. 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

  1. 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

to_voxel_grid(self)#

Convert to VoxelGrid.

Returns:

open3d.geometry.VoxelGrid

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

traverse(self: open3d.cpu.pybind.geometry.Octree, f: Callable[[open3d.cpu.pybind.geometry.OctreeNode, open3d.cpu.pybind.geometry.OctreeNodeInfo], bool]) None#

DFS traversal of the octree from the root, with a callback function f being called for each node.

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 max_depth#

Maximum depth of the octree. The depth is defined as the distance from the deepest leaf node to root. A tree with only the root node has depth 0.

Type:

int

property origin#

Global min bound (include). A point is within bound iff origin <= point < origin + size.

Type:

(3, 1) float numpy array

property root_node#

The root octree node.

Type:

OctreeNode

property size#

Outer bounding box edge size for the whole octree. A point is within bound iff origin <= point < origin + size.

Type:

float