Add a Camera.forward() getter (world-space viewing direction)#61
Open
dchaudhari7177 wants to merge 1 commit into
Open
Add a Camera.forward() getter (world-space viewing direction)#61dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
1 task
Owner
|
Approved this one @dchaudhari7177 — thank you! It picked up a one-line conflict in cameras.py because #60 (the Intrinsics validator) merged just before it. Could you rebase on latest main and resolve? Should be trivial. Then it goes straight in. Closes #58. |
centre() reads the camera position off R/t, but there was no getter for the direction the camera is looking — useful for logging, frustum checks and pointing sanity tests. R's rows are the camera axes in world coordinates as [right, down, forward] (OpenCV, +z forward), so the forward axis is the third row. forward() returns it as a length-3 unit array. Read-only, no new dependency. Closes bamdadd#58
dchaudhari7177
force-pushed
the
feat/camera-forward
branch
from
July 22, 2026 16:21
0f442c6 to
e436771
Compare
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.
Closes #58.
Camera.centre()gives the camera position, but there was no getter for the direction the camera is looking — handy for logging, frustum checks, and "is this camera pointed the right way?" sanity tests.Change:
Camera.forward() -> FloatArrayreturns the world-space unit viewing direction.R's rows are the camera axes in world coordinates in the order[right, down, forward](OpenCV, +z forward), so the forward axis is the third row — already unit length for an orthonormalR. Placed next tocentre(). Pure read-only, no new dependency.Acceptance criteria:
forward()returns a length-3 world-space unit vector (norm ≈ 1). ✅Camera.look_at(0, intr, eye, target)hasforward()≈normalize(target - eye). ✅ruff check/formatandmypyclean on the changed files; new tests pass.