Open3d获取到的包围盒的包围盒八点的顺序是三角面,一遍走完8点的排序,我想要的是底部四点+顶部四点最后合成的八个numpy点
思路:将八点按Z轴值分为上四点和下四点,然后再分别排序,最后再组合输出
核心代码:
# 根据 Z 值对点进行排序
sorted_points = bottom_points_np[np.argsort(bottom_points_np[:, 2])]
# 获取 Z 值最小的四个点
points = sorted_points[:4]
# 计算中心点坐标
center = np.mean(points, axis=0)
# 计算每个点相对于中心点的极坐标角度np.arctan2(y,x)
angles = np.arctan2(points[:, 1] - center[1], points[:, 0] - center[0])
# 对角度进行排序
sorted_indices = np.argsort(angles)
points = points[sorted_indices]
import json
import copy
import numpy as np
import open3d as o3d
'''
作者 &#x