Opt-in centered marker origin (setOriginCentered) (#38)#40
Merged
Conversation
Expose the library's new setOriginCentered option to JS and use it in the examples so AR content anchors at the marker CENTRE instead of the reference top-left corner. Opt-in; default off (ArtoolkitX parity). - emscripten/WebARKitJS.cpp/.h + bindings.cpp: bind setOriginCentered - src/WebARKitController.js: setOriginCentered(centered) - examples/worker_threejs.js + worker_teblid_webcam_threejs.js: call setOriginCentered(true) after init - rebuild build/ + dist/, bump WebARKitLib submodule (fe588e5) - docs/design-center-origin-option.md: design + decision log + ArtoolkitX investigation Verified on the static + webcam examples: true -> content centred; false/default -> corner (unchanged). Depends on webarkit/WebARKitLib#49. Closes #38 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
webarkit/WebARKitLib#49 merged into dev (rebased to 15dc93f). Re-point the submodule from the fork-branch commit to the canonical dev tip; source identical, build/ and dist/ unchanged. Refs #38, webarkit/WebARKitLib#49 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets AR content anchor at the marker centre instead of the reference image's top-left corner, via a new opt-in option. Fixes #38.
Exposes the WebARKitLib option (webarkit/WebARKitLib#49) to JS and turns it on in the examples; bundled here via the submodule bump + rebuilt
build//dist/.What's included
emscripten/WebARKitJS.cpp/.h+emscripten/bindings.cpp— bindsetOriginCentered.src/WebARKitController.js—setOriginCentered(centered).examples/worker_threejs.js+worker_teblid_webcam_threejs.js— callwark.setOriginCentered(true)after init (static + webcam examples).build/+dist/; submodule bump to the library change.docs/design-center-origin-option.md— design, decision log, and the full ArtoolkitX investigation (it never centres anywhere → default off).How it works
Library-side: when enabled, the 3D
solvePnPobject points are offset by(_pattern.size/2)before the pose solve — moves only the translation (origin → centre), rotation unchanged, 2D matching/template/homography untouched. Default off (ArtoolkitX parity); examples opt in. No per-example offset math — the box stays at(0,0,0.3)and is now centred + lifted.Testing
Static + webcam examples:
true→ cube/axes centred on the marker, orientation unchanged;false/default → back to the corner (verified both directions).Review checklist
setOriginCenteredisn't called.vscode/settings.jsonintentionally excludedRelated
Closes #38
🤖 Generated with Claude Code