open3d.geometry.AxisAlignedBoundingBox.dimension
方法用于获取轴对齐包围盒(AABB)的尺寸。
dimension(self) -> numpy.ndarray
无
返回一个三维numpy数组,包含轴对齐包围盒的每个维度的尺寸。
import open3d as o3d
import numpy as np
# 创建一个立方体
points = np.zeros((8, 3))
points[1, 0] = 1
points[2, 1] = 1
points[3, 0] = 1
points[3, 1] = 1
points[4, 2] = 1
points[5, 0] = 1
points[5, 2] = 1
points[6, 1] = 1
points[6, 2] = 1
points[7, 0] = 1
points[7, 1] = 1
points[7, 2] = 1
mesh = o3d.geometry.TriangleMesh.create_box()
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.1, 0.1, 0.7])
mesh.compute_vertex_normals()
# 创建轴对齐包围盒
aabb = mesh.get_axis_aligned_bounding_box()
# 输出轴对齐包围盒尺寸
print(aabb.dimension())
[1. 1. 1.]
无
open3d.geometry.AxisAlignedBoundingBox.get_center()
:获取轴对齐包围盒的中心点。open3d.geometry.AxisAlignedBoundingBox.get_extent()
:获取轴对齐包围盒的尺寸和方向。