Commit 3429eb3
Fix CV->GL pose conversion in updateTrackable()
Stop negating rotation columns 1 and 2 in updateTrackable(). The previous
behavior applied a partial CV->GL conversion (rotation columns flipped,
translation untouched), which left consumers with an inconsistent pose:
the rotation was neither raw OpenCV nor a clean GL right-handed modelview,
and the translation Z stayed positive — causing tracked objects to render
behind the camera in OpenGL/three.js scenes (clip.w < 0, ndc.z > 1).
After this change, getPoseMatrix2() / trans returns the raw OpenCV pose
(rotation unmodified, translation kept at the existing 0.001 * 1.64 scale).
The CV->GL handedness flip (negate Y and Z rows including translation) is
applied downstream by arglCameraViewRHf when building the GL right-handed
modelview (matrixGL_RH on the JS side, getGLViewMatrix() in WebARKitManager
on the C++ side). Both downstream paths are now mathematically clean
diag(1, -1, -1, 1) * pose conversions and produce a correct modelview that
places the tracked object in front of the GL camera.
Note: this is a semantic change to `pose` / `trans` for any consumer that
relied on the previous partially-converted shape. Downstream consumers
should use matrixGL_RH (or getGLViewMatrix) for OpenGL rendering and treat
`pose` as the raw OpenCV camera pose.
Refs: #34, webarkit/webarkit-testing#31
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 891f50f commit 3429eb3
1 file changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
59 | 65 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
0 commit comments