Move pure orbit-camera math to src/utils/camera#359
Merged
Conversation
orbitCamera.ts was already a pure, dependency-free state-to-matrices module — it belongs under src/utils, not services/camera (which is now just the DOM-bound orbitControls + the drag-register seeder). Split per the one-function-per-file utils convention: - clampDistance.ts (+ MIN/MAX_DISTANCE_MPC clamp policy) - updatePosition.ts - createOrbitCamera.ts - computeViewProj.ts Repoint all importers; move the cohesive math test to tests/utils/camera. typecheck clean; full suite 2977 green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
skymap | 8496adf | Commit Preview URL Branch Preview URL |
Jun 20 2026, 05:25 PM |
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.
What
src/services/camera/orbitCamera.tswas already a pure, dependency-free state-to-matrices module (its own header: "intentionally free of browser or WebGPU dependencies so it can be tested in a plain Node/Vitest environment"). It belongs undersrc/utils, alongside the other pure math helpers — not inservices/camera/, which is now just the DOM-boundorbitControls+ the drag-register seeder.Changes
Split into
src/utils/camera/per the one-function-per-fileutils/convention:clampDistance.ts—clampDistance+ theMIN/MAX_DISTANCE_MPCclamp-policy constants (kept together as the single source of truth for the zoom envelope)updatePosition.ts— spherical → Cartesian positioncreateOrbitCamera.ts— construction (imports./updatePosition)computeViewProj.ts— view-projection matrix (incl. Rodrigues roll)All didactic comments preserved. Repointed all 11 importers (src + tools + tests + the
EngineStatetypeoftype import). Moved the cohesive math test totests/utils/camera/orbitCamera.test.ts(mirrors theclampVolume.test.tscluster-grouping precedent).orbitControls.tsstays put — it's input handling, not pure math.Verification
npm run typecheckclean (src + tools)npm test— 2977 passed🤖 Generated with Claude Code