From ba87af34f46bf7c9fc3796237e080c6296075cbf Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 20:26:12 +0000 Subject: [PATCH] Changes Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com> --- src/components/three/viewCubeBus.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;