Skip to content

Add Mat44 camera and billboard transforms - #66

Merged
crertel merged 1 commit into
masterfrom
44-mat44-camera
Sep 16, 2026
Merged

crertel merged 1 commit into
masterfrom
44-mat44-camera

Conversation

@crertel

@crertel crertel commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Adds camera and billboard transforms to Mat44:

  • orient(position, forward, up) maps local coordinates into world space.
  • look_at(eye, center, up) maps world coordinates into camera space and is the inverse of the corresponding orientation transform.
  • make_billboard(position, camera_position, camera_up) creates a spherical billboard.
  • make_billboard_axis(position, camera_position, axis) creates a cylindrical billboard whose local +Y stays aligned with the supplied axis.

All four use right-handed row-vector transforms, with local -Z forward/front, +Y up, and +X right. The view matrix sends the eye to the origin and its target onto negative Z, following the OpenGL viewing convention. Direction inputs are normalized internally, with scaling to handle very large or small magnitudes. Zero directions, coincident positions, and parallel or nearly parallel directions raise ArithmeticError; the angular degeneracy threshold is documented as a normalized cross-product length of 1.0e-12, consistent with the existing orthonormalization tolerance.

Float typespecs and explicit float clauses are preserved, with numeric fallback clauses. The docs distinguish local-to-world transforms from view matrices and specify the billboard front direction.

Validation: 579 tests and 5 doctests pass with 100% line coverage. New tests cover known axis-aligned and oblique bases, view/pose inverses, all signed coordinate axes, spherical versus cylindrical behavior, oblique rotation axes, translation and homogeneous coordinates, mixed numeric inputs, magnitude scaling, and degenerate inputs. Formatting, compilation with warnings as errors, and documentation generation pass.

Part of #44. Projection helpers will follow separately.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — 44-mat44-camera into master

@crertel
crertel merged commit f8f958a into master Sep 16, 2026
4 checks 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.

2 participants