From 36c7889db1d08efd6061b19d67f5f1e11ba7c743 Mon Sep 17 00:00:00 2001 From: Floppyrj45 Date: Fri, 24 Apr 2026 10:48:55 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20PLY=20d=C3=A9cimation=20voxel=20volum?= =?UTF-8?q?=C3=A9trique=203D=20+=20open3d=20lazy=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- viz/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/viz/server.py b/viz/server.py index 2560a31..7899c3a 100644 --- a/viz/server.py +++ b/viz/server.py @@ -96,9 +96,11 @@ def _load_data() -> dict: import open3d as o3d pcd = o3d.io.read_point_cloud(_PLY_PATH) n_pts = len(pcd.points) - if n_pts > 200_000: - vox = float((pcd.get_max_bound() - pcd.get_min_bound()).max()) * (200_000 / n_pts) ** (1/3) - pcd = pcd.voxel_down_sample(float(vox)) + MAX_PTS = 300_000 + if n_pts > MAX_PTS: + vol = float(np.prod(pcd.get_max_bound() - pcd.get_min_bound())) + vox = max((vol / MAX_PTS) ** (1/3), 0.02) + pcd = pcd.voxel_down_sample(vox) pts = np.asarray(pcd.points) ce = out.get("origin", {}).get("easting", 0.0) cn = out.get("origin", {}).get("northing", 0.0)