Skip to content

feat(cameras): add Intrinsics.fov_deg() getter#55

Merged
bamdadd merged 1 commit into
bamdadd:mainfrom
dchaudhari7177:feat/intrinsics-fov-deg
Jul 22, 2026
Merged

feat(cameras): add Intrinsics.fov_deg() getter#55
bamdadd merged 1 commit into
bamdadd:mainfrom
dchaudhari7177:feat/intrinsics-fov-deg

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

What

Intrinsics.from_fov(...) builds intrinsics from a field of view, but there was no getter to read the FOV back off an existing Intrinsics — useful for logging, sanity checks, and picking a rig radius.

Adds Intrinsics.fov_deg() -> tuple[float, float] next to matrix(), returning (horizontal_fov_deg, vertical_fov_deg) by inverting from_fov per axis:

fov = 2 * degrees(atan((size / 2) / f))

Acceptance criteria

  • fov_deg() returns (h, v) in degrees
  • ✅ round trip: Intrinsics.from_fov(60, 640, 480).fov_deg()[0] == pytest.approx(60)
  • ✅ square-pixel case (fy == fx) → vertical follows from the aspect ratio; independent-axis case round-trips both (90/60)
  • ruff and mypy clean, pytest green

Tests

Three cases in tests/test_cameras.py: horizontal round trip, square-pixel aspect (fov_y < fov_x for 640×480), and independent horizontal/vertical round trip. Full file: 15 passed.

Fixes #52

from_fov builds intrinsics from a field of view but there was no way to
read the FOV back off an existing Intrinsics. Add fov_deg() -> (h, v),
inverting from_fov per axis: fov = 2*degrees(atan((size/2)/f)). Handy
for logging, sanity checks, and picking a rig radius.

Fixes bamdadd#52
@bamdadd
bamdadd merged commit 8c2ef92 into bamdadd:main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an Intrinsics.fov_deg() getter (inverse of from_fov)

3 participants