Skip to content

Opt-in centered marker origin (setOriginCentered) (#38)#40

Merged
kalwalt merged 2 commits into
devfrom
fix/center-origin-38
Jun 16, 2026
Merged

Opt-in centered marker origin (setOriginCentered) (#38)#40
kalwalt merged 2 commits into
devfrom
fix/center-origin-38

Conversation

@kalwalt

@kalwalt kalwalt commented Jun 16, 2026

Copy link
Copy Markdown
Member

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 — bind setOriginCentered.
  • src/WebARKitController.jssetOriginCentered(centered).
  • examples/worker_threejs.js + worker_teblid_webcam_threejs.js — call wark.setOriginCentered(true) after init (static + webcam examples).
  • Rebuilt 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 solvePnP object 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

  • Build artifacts match the bumped submodule source
  • Default-off path unchanged (corner origin) when setOriginCentered isn't called
  • .vscode/settings.json intentionally excluded

Related

Closes #38

🤖 Generated with Claude Code

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>
@kalwalt kalwalt moved this from To do to Review in progress in New markerless image tracking Jun 16, 2026
@kalwalt kalwalt moved this from Review in progress to Reviewer approved in New markerless image tracking Jun 16, 2026
@kalwalt kalwalt merged commit a18b4a6 into dev Jun 16, 2026
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in New markerless image tracking Jun 16, 2026
@kalwalt kalwalt deleted the fix/center-origin-38 branch June 16, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Emscripten / C / C++ all about Emscripten enhancement New feature or request javascript

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

AR content anchors at the marker's top-left corner, not its center

1 participant