diff --git a/src/components/three/viewCubeBus.ts b/src/components/three/viewCubeBus.ts index cf9e3b8..85bbadc 100644 --- a/src/components/three/viewCubeBus.ts +++ b/src/components/three/viewCubeBus.ts @@ -164,7 +164,11 @@ export function pushModelFaceNormal(normalWorld: THREE.Vector3, calGroupWorldQua const cubeWorld = calibration.pendingCube; const inv = calGroupWorldQuat.clone().invert(); const cubeLocal = cubeWorld.clone().applyQuaternion(inv).normalize(); - const modelLocal = normalWorld.clone().applyQuaternion(inv).normalize(); + const modelLocalRaw = normalWorld.clone().applyQuaternion(inv).normalize(); + // Snap near-axial picks (chamfered or slightly off faces) to the closest + // principal axis. This dramatically improves robustness when picking faces + // from an orthographic head-on view. + const modelLocal = snapToPrincipalAxis(modelLocalRaw, 12); calibration.pairs.push({ cube: cubeLocal, model: modelLocal }); calibration.pendingCube = null;