clear
方法用于清空Matrix3dVector中的所有矩阵。
clear()
无参数。
无返回值。
import open3d as o3d
import numpy as np
# 创建示例矩阵
m1 = np.eye(3)
m2 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
m3 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
# 创建Matrix3dVector对象并添加矩阵
matrix_vector = o3d.utility.Matrix3dVector()
matrix_vector.append(m1)
matrix_vector.append(m2)
matrix_vector.append(m3)
print('清空前:', matrix_vector)
# 清空矩阵向量
matrix_vector.clear()
print('清空后:', matrix_vector)
输出:
清空前: Matrix3dVector with 3 elements.
清空后: Matrix3dVector with 0 elements.