Optional centered marker origin (setOriginCentered) — webarkit-testing#38#49
Merged
Merged
Conversation
Add an opt-in option so the tracked pose origin is the marker centre instead of the reference image's top-left corner -- AR content at (0,0,0) then sits in the middle of the marker. Default OFF (matches ArtoolkitX, which never centres at any layer, and preserves existing behaviour). When enabled, the 3D object points are offset by (_pattern.size/2) just before solvePnP: this moves only the solved translation, leaves the rotation unchanged, and the 2D matching/template/homography paths untouched. Exposed as setOriginCentered(bool) via the tracker and manager. Refs webarkit/webarkit-testing#38 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 tasks
Member
Author
|
Companion JS/binding + examples + build PR: webarkit/webarkit-testing#40 |
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 16, 2026
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>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 16, 2026
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>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 16, 2026
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>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 21, 2026
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>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 21, 2026
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
Adds an opt-in option so the tracked pose origin is the marker centre instead of the reference image's top-left corner. With it on, AR content placed at
(0,0,0)sits in the middle of the marker.Implements the library half of webarkit/webarkit-testing#38.
Why opt-in / default OFF
Verified the full ArtoolkitX OCVT chain — it never centres (TrackingPointSelector uses raw top-left pixels; ARTrackable2d only negates Y,Z columns + scales translation; even the example
drawCubeonly lifts +Z). So WebARKit's current corner origin already matches ArtoolkitX. Centring is a WebARKit convenience → default OFF preserves parity and existing behaviour.How
When enabled, the 3D object points are offset by
(_pattern.size.width/2, _pattern.size.height/2)just beforesolvePnP:Offsetting the object points moves only the solved translation; the rotation is unchanged (orientation unaffected). Applied to the
solvePnP3D points only — the 2DimgPointsand the matching/template/homography paths stay in raw image space.API
setOriginCentered(bool)threaded throughWebARKitTracker(pimpl) andWebARKitManager(defaultfalse). The emscripten binding + JS wiring live in the companion webarkit-testing PR.Testing
Verified against the static + webcam Teblid examples:
true→ cube/axes centred on the marker, correct orientation;false/default → back to the corner (no behaviour change).Refs webarkit/webarkit-testing#38
🤖 Generated with Claude Code