feat: 算法升级、整车配准集成与性能分析文档
算法更新: delivery v1.2.1、平整度v1.5、测距v2.2、整车配准v1.3 适配器: vehicle-registration 新增、各算法 manifest 和 adapter 更新 后端: taskCadFiles/source 字段迁移、derivedPointClouds 注册、取消任务联动 前端: ElapsedTime 时长显示、两步算法流程、canRun 逻辑修复 文档: 新增5份算法性能分析报告
This commit is contained in:
25
alg/平整度、平面度、轮廓测量v1.5/archive/relative_code/test5.py
Normal file
25
alg/平整度、平面度、轮廓测量v1.5/archive/relative_code/test5.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import trimesh
|
||||
import numpy as np
|
||||
import open3d as o3d
|
||||
import time
|
||||
# 1. 读取数据
|
||||
mesh_trimesh = trimesh.load("E:\point_distance\data\\40.stl")
|
||||
pcd_o3d = o3d.io.read_point_cloud("E:\point_distance\data\\40_noisy.ply")
|
||||
points = np.asarray(pcd_o3d.points)
|
||||
start_time = time.time()
|
||||
|
||||
# ========== 1. 读取数据 ==========
|
||||
|
||||
t0 = time.time()
|
||||
# 2. 使用 trimesh 计算每个点到 Mesh 的最近距离
|
||||
# trimesh 的 nearest 方法非常高效且精确
|
||||
closest_points, distances, triangle_ids = mesh_trimesh.nearest.on_surface(points)
|
||||
t1=time.time()
|
||||
|
||||
# distances 即为所求的距离数组
|
||||
print(f"平均距离: {np.mean(distances)}")
|
||||
print(f"最大距离: {np.max(distances)}")
|
||||
print(f" 距离计算: {t1 - t0:.4f} 秒")
|
||||
# 如果需要将结果存回 Open3D 点云进行可视化
|
||||
dists_o3d = o3d.utility.DoubleVector(distances.tolist())
|
||||
# 注意:Open3D 点云对象本身不直接存储标量距离字段用于内置可视化着色
|
||||
Reference in New Issue
Block a user