mirror of
https://github.com/tiennm99/rubik.git
synced 2026-05-13 22:58:32 +00:00
edcb95c4a6
Drag-down on +z front-face cubies still inverted direction after the face-anchor fix. Root cause was a dual-reference-frame mismatch in chooseRotationAxis: curAngle = (drag · pixelsAxis) * signMul ← measured along pixelsAxis signMul = sign(motionScreen · drag) ← measured against drag When pixelsAxis and the drag vector are anti-aligned (e.g. dragAxis='y' where pixelsAxis points screen-UP since world +y projects to screen -y, but the user drags screen-DOWN), the two reference frames disagree and sign(curAngle) ends up opposite sign(motionScreen · drag) — so positive rotation moves the cubie opposite the user's drag. Fix: compare motionScreen against pixelsAxis (= screenDirs[dragAxisIdx]) so both halves of the curAngle formula share the same reference frame. Adds 24 correctness tests asserting sign(curAngle) == sign(motionScreen · drag) for every face × cardinal drag — fails on the previous code, passes after the fix. Also removes the temporary RUBIK_DEBUG diagnostic logs.