Show inter-marker spread in dev HUD (updateDbg takes spread)

This commit is contained in:
2026-08-04 11:33:50 +10:00
parent bb049f684c
commit e8d6a2f4b6
+4 -3
View File
@@ -43,7 +43,7 @@ let clockOffset = 0; // serverNow - clientNow
const _dbgEuler = new THREE.Euler();
const _dbgV = new THREE.Vector3();
let dbgEl = null;
function updateDbg(fusedQuat, markerCount) {
function updateDbg(fusedQuat, markerCount, spread) {
if (!dbgEl) return;
const deg = r => (r * 180 / Math.PI).toFixed(0).padStart(4);
// raw fused (CV-frame) orientation as YXZ euler
@@ -53,9 +53,10 @@ function updateDbg(fusedQuat, markerCount) {
const view = _dbgV.set(0, 0, -1).applyQuaternion(camera3.quaternion).clone();
const up = _dbgV.set(0, 1, 0).applyQuaternion(camera3.quaternion).clone();
const v3 = v => `(${v.x.toFixed(2)},${v.y.toFixed(2)},${v.z.toFixed(2)})`;
const spreadLine = markerCount > 1 ? ` spread ${spread.toFixed(1)}cm` : '';
dbgEl.textContent =
`rot ${getRotMode()} cam ${camMode} (tap to cycle)\n` +
`markers ${markerCount}\n${rawLine}\nview ${v3(view)}\nup ${v3(up)}\n` +
`markers ${markerCount}${spreadLine}\n${rawLine}\nview ${v3(view)}\nup ${v3(up)}\n` +
`pos ${v3(camera3.position)}`;
}
@@ -268,7 +269,7 @@ function loop(t) {
// pose.js already conjugated rotation into the three.js frame; apply any
// residual camera-frame correction (switchable via overlay)
camera3.quaternion.copy(fused.quaternion).multiply(CAM_CORR[camMode]);
updateDbg(fused.quaternion, fused.markerCount);
updateDbg(fused.quaternion, fused.markerCount, fused.spread);
}
}
}