stpete2 commited on
Commit
e78a59b
·
verified ·
1 Parent(s): ec8b950

Upload preprocess_manual.js

Browse files
Files changed (1) hide show
  1. preprocess_manual.js +15 -6
preprocess_manual.js CHANGED
@@ -1355,12 +1355,15 @@ parser.parsePLY(gsPath, true).then((plyData) => {
1355
  // ========================================
1356
  // ⭐ 4. カメラをPLYに合わせて調整(cameraControls初期化後)
1357
  // ========================================
1358
- console.log('[preprocessManual] Auto-aligning camera to PLY...');
1359
 
1360
- // PLYのバウンディングボックスの中心とサイズを取得
 
 
 
 
1361
  let minX = Infinity, minY = Infinity, minZ = Infinity;
1362
  let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
1363
-
1364
  plyData.vertices.forEach(vertex => {
1365
  minX = Math.min(minX, vertex.x);
1366
  minY = Math.min(minY, vertex.y);
@@ -1369,19 +1372,25 @@ parser.parsePLY(gsPath, true).then((plyData) => {
1369
  maxY = Math.max(maxY, vertex.y);
1370
  maxZ = Math.max(maxZ, vertex.z);
1371
  });
1372
-
1373
  const center = {
1374
- x: (maxX + minX) / 2,
1375
  y: (maxY + minY) / 2,
1376
  z: (maxZ + minZ) / 2
1377
  };
1378
-
1379
  const size = {
1380
  x: maxX - minX,
1381
  y: maxY - minY,
1382
  z: maxZ - minZ
1383
  };
 
 
 
 
1384
 
 
 
1385
  const maxDim = Math.max(size.x, size.y, size.z);
1386
 
1387
  // カメラ位置を計算
 
1355
  // ========================================
1356
  // ⭐ 4. カメラをPLYに合わせて調整(cameraControls初期化後)
1357
  // ========================================
 
1358
 
1359
+ //////////////////////ここから
1360
+
1361
+ console.log('[preprocessManual] Auto-aligning camera to PLY...');
1362
+
1363
+ // ⭐⭐⭐ センタリング後のデータから計算 ⭐⭐⭐
1364
  let minX = Infinity, minY = Infinity, minZ = Infinity;
1365
  let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;
1366
+
1367
  plyData.vertices.forEach(vertex => {
1368
  minX = Math.min(minX, vertex.x);
1369
  minY = Math.min(minY, vertex.y);
 
1372
  maxY = Math.max(maxY, vertex.y);
1373
  maxZ = Math.max(maxZ, vertex.z);
1374
  });
1375
+
1376
  const center = {
1377
+ x: (maxX + minX) / 2, // ← ほぼ 0 になる
1378
  y: (maxY + minY) / 2,
1379
  z: (maxZ + minZ) / 2
1380
  };
1381
+
1382
  const size = {
1383
  x: maxX - minX,
1384
  y: maxY - minY,
1385
  z: maxZ - minZ
1386
  };
1387
+
1388
+ console.log('[preprocessManual] Camera alignment - PLY center:', center);
1389
+ console.log('[preprocessManual] Camera alignment - PLY size:', size);
1390
+
1391
 
1392
+ //////////////////////ここまで
1393
+
1394
  const maxDim = Math.max(size.x, size.y, size.z);
1395
 
1396
  // カメラ位置を計算