目录
import numpy as np
from mayavi import mlab
# 创建示例点云数据
num_points = 100
points = np.random.rand(num_points, 3) # 生成随机点云数据
directions = np.random.rand(num_points, 3) # 生成随机方向数据
# 显示点云
mlab.figure(bgcolor=(1, 1, 1)) # 设置背景颜色为白色
mlab.points3d(points[:, 0], points[:, 1], points[:, 2], scale_factor=0.1, color=(0, 0, 1)) # 显示点云
# 添加箭头表示方向
for i in range(num_points):
mlab.quiver3d(points[i, 0], points[i, 1], points[i, 2],
directions[i, 0], directions[i, 1], directions[i, 2],
color=(1, 0, 0), mode='arrow', scale_factor=0.2)
mlab.show()
import numpy as np
from mayavi import mlab
# 生成示例点云数据和对应的方向信息(假设这里是假设的方向信息)
num_points = 100
points = np.random.rand(num_points, 3)
directions = np.random.rand(num_points, 3) # 假设这里是方向信息
# 显示点云
mlab.figure(bgcolor=(1, 1, 1))
mlab.points3d(points[:, 0], points[:, 1], points[:, 2], scale_factor=0.05, color=(0, 0, 1))
# 添加方向箭头
for i in range(num_points):
endpoint = points[i] + directions[i] * 0.1 # 假设每个点的方向信息
mlab.quiver3d(points[i, 0], points[i, 1], points[i, 2],
endpoint[0], endpoint[1], endpoint[2],
color=(1, 0, 0), mode='arrow', scale_factor=1)
mlab.show()