Upload preprocess_manual.js
Browse files- preprocess_manual.js +18 -48
preprocess_manual.js
CHANGED
|
@@ -1314,15 +1314,17 @@ parser.parsePLY(gsPath, true).then((plyData) => {
|
|
| 1314 |
// ⭐ 4. カメラをPLYに合わせて調整(cameraControls初期化後)
|
| 1315 |
// ========================================
|
| 1316 |
|
| 1317 |
-
|
| 1318 |
-
|
| 1319 |
|
| 1320 |
// ========================================
|
| 1321 |
-
//
|
|
|
|
| 1322 |
// ========================================
|
|
|
|
| 1323 |
console.log('[preprocessManual] Auto-aligning camera to PLY...');
|
| 1324 |
|
| 1325 |
-
//
|
| 1326 |
console.log('[preprocessManual] Verifying PLY centering...');
|
| 1327 |
|
| 1328 |
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
@@ -1360,39 +1362,18 @@ parser.parsePLY(gsPath, true).then((plyData) => {
|
|
| 1360 |
console.error('[preprocessManual] Expected center ~(0,0,0) but got:', calculatedCenter);
|
| 1361 |
console.error('[preprocessManual] This indicates Step 1 did not work correctly!');
|
| 1362 |
|
| 1363 |
-
// ⭐
|
| 1364 |
-
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
|
| 1371 |
-
//
|
| 1372 |
-
minX = Infinity; minY = Infinity; minZ = Infinity;
|
| 1373 |
-
maxX = -Infinity; maxY = -Infinity; maxZ = -Infinity;
|
| 1374 |
-
|
| 1375 |
-
plyData.vertices.forEach(vertex => {
|
| 1376 |
-
minX = Math.min(minX, vertex.x);
|
| 1377 |
-
minY = Math.min(minY, vertex.y);
|
| 1378 |
-
minZ = Math.min(minZ, vertex.z);
|
| 1379 |
-
maxX = Math.max(maxX, vertex.x);
|
| 1380 |
-
maxY = Math.max(maxY, vertex.y);
|
| 1381 |
-
maxZ = Math.max(maxZ, vertex.z);
|
| 1382 |
-
});
|
| 1383 |
-
|
| 1384 |
-
calculatedCenter.x = (maxX + minX) / 2;
|
| 1385 |
-
calculatedCenter.y = (maxY + minY) / 2;
|
| 1386 |
-
calculatedCenter.z = (maxZ + minZ) / 2;
|
| 1387 |
-
|
| 1388 |
-
console.log('[preprocessManual] After force re-centering:', {
|
| 1389 |
-
x: calculatedCenter.x.toFixed(6),
|
| 1390 |
-
y: calculatedCenter.y.toFixed(6),
|
| 1391 |
-
z: calculatedCenter.z.toFixed(6)
|
| 1392 |
-
});
|
| 1393 |
}
|
| 1394 |
|
| 1395 |
-
// ⭐ カメラ配置は 0,0,0
|
| 1396 |
const center = { x: 0, y: 0, z: 0 };
|
| 1397 |
|
| 1398 |
const size = {
|
|
@@ -1430,25 +1411,14 @@ parser.parsePLY(gsPath, true).then((plyData) => {
|
|
| 1430 |
|
| 1431 |
///////////////////////////////////////修正1: Line 1319-1375 を完全に書き換え
|
| 1432 |
|
| 1433 |
-
|
| 1434 |
-
// ========================================
|
| 1435 |
-
// ⭐ 5. Scene bounds の計算と表示
|
| 1436 |
-
// ========================================
|
| 1437 |
-
const sceneSize = {
|
| 1438 |
-
x: maxX - minX,
|
| 1439 |
-
y: maxY - minY,
|
| 1440 |
-
z: maxZ - minZ
|
| 1441 |
-
};
|
| 1442 |
const sceneCenter = {
|
| 1443 |
x: (maxX + minX) / 2,
|
| 1444 |
y: (maxY + minY) / 2,
|
| 1445 |
z: (maxZ + minZ) / 2
|
| 1446 |
};
|
| 1447 |
|
| 1448 |
-
|
| 1449 |
-
|
| 1450 |
-
center: sceneCenter
|
| 1451 |
-
});
|
| 1452 |
|
| 1453 |
// Display scene info in UI
|
| 1454 |
const sceneSizeEl = document.getElementById('scene-size');
|
|
|
|
| 1314 |
// ⭐ 4. カメラをPLYに合わせて調整(cameraControls初期化後)
|
| 1315 |
// ========================================
|
| 1316 |
|
| 1317 |
+
|
| 1318 |
+
// 修正版: カメラ配置部分(Line 1319-1430付近)
|
| 1319 |
|
| 1320 |
// ========================================
|
| 1321 |
+
// 修正版: カメラ配置部分(Line 1319-1430付近)
|
| 1322 |
+
// 2回目の中心化を削除し、検証のみに変更
|
| 1323 |
// ========================================
|
| 1324 |
+
|
| 1325 |
console.log('[preprocessManual] Auto-aligning camera to PLY...');
|
| 1326 |
|
| 1327 |
+
// ⭐ 検証のみ実行(中心化は削除)
|
| 1328 |
console.log('[preprocessManual] Verifying PLY centering...');
|
| 1329 |
|
| 1330 |
let minX = Infinity, minY = Infinity, minZ = Infinity;
|
|
|
|
| 1362 |
console.error('[preprocessManual] Expected center ~(0,0,0) but got:', calculatedCenter);
|
| 1363 |
console.error('[preprocessManual] This indicates Step 1 did not work correctly!');
|
| 1364 |
|
| 1365 |
+
// ⭐ エラーメッセージのみ表示(中心化は実行しない)
|
| 1366 |
+
alert('⚠️ PLY Centering Error!\n\n' +
|
| 1367 |
+
'The PLY data is not centered at origin.\n' +
|
| 1368 |
+
'Expected: ~(0, 0, 0)\n' +
|
| 1369 |
+
'Got: (' + calculatedCenter.x.toFixed(2) + ', ' +
|
| 1370 |
+
calculatedCenter.y.toFixed(2) + ', ' +
|
| 1371 |
+
calculatedCenter.z.toFixed(2) + ')\n\n' +
|
| 1372 |
+
'Please reload the page and try again.');
|
| 1373 |
+
return; // 処理を中断
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1374 |
}
|
| 1375 |
|
| 1376 |
+
// ⭐ カメラ配置は 0,0,0 を中心にする(修正なし)
|
| 1377 |
const center = { x: 0, y: 0, z: 0 };
|
| 1378 |
|
| 1379 |
const size = {
|
|
|
|
| 1411 |
|
| 1412 |
///////////////////////////////////////修正1: Line 1319-1375 を完全に書き換え
|
| 1413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1414 |
const sceneCenter = {
|
| 1415 |
x: (maxX + minX) / 2,
|
| 1416 |
y: (maxY + minY) / 2,
|
| 1417 |
z: (maxZ + minZ) / 2
|
| 1418 |
};
|
| 1419 |
|
| 1420 |
+
|
| 1421 |
+
// 修正版: カメラ配置部分(Line 1319-1430付近)
|
|
|
|
|
|
|
| 1422 |
|
| 1423 |
// Display scene info in UI
|
| 1424 |
const sceneSizeEl = document.getElementById('scene-size');
|