Camera class

Immutable pinhole camera used for Gaussian splatting.

Holds intrinsics (fx, fy, width, height) and extrinsics (position, rotation) and can produce view/projection matrices in OpenGL conventions (column-major).

Annotations

Constructors

Camera({required int id, required int width, required int height, required Vector3 position, required Matrix3 rotation, required double fx, required double fy, double znear = 0.2, double zfar = 200.0, double ndcYSign = -1.0})
Creates a camera with explicit intrinsics and extrinsics.
const
Camera.createDefault({required double width, required double height, required double ndcYSign, double horizontalFovDegrees = 45.0, Vector3? position, Matrix3? rotation, int id = 0, double znear = 0.2, double zfar = 200.0})
Creates a reasonable default camera from a horizontal FOV and image size.
factory

Properties

fx → double
Focal length in pixels along the x-axis.
final
fy → double
Focal length in pixels along the y-axis.
final
hashCode → int
The hash code for this object.
no setterinherited
height → int
Image height in pixels.
final
horizontalFovDegrees → double
Current horizontal field of view in degrees.
no setter
id → int
Unique identifier for this camera.
final
ndcYSign → double
Sign applied to clip-space Y (and to fy for screen-space math). +1 = OpenGL default; −1 = vertically flipped (Flutter texture).
final
position → Vector3
Camera position in world space.
final
rotation → Matrix3
Camera → world rotation (columns: right, up, forward).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
verticalFovDegrees → double
Current vertical field of view in degrees.
no setter
width → int
Image width in pixels.
final
yIsFlipped → bool
Convenience flags
no setter
zfar → double
Far clip plane (OpenGL space).
final
znear → double
Near clip plane (OpenGL space).
final

Methods

copyWith({int? id, int? width, int? height, Vector3? position, Matrix3? rotation, double? fx, double? fy, double? znear, double? zfar, double? ndcYSign}) → Camera
Creates a copy with selected fields changed.
copyWithPose({required Vector3 position, required Matrix3 rotation}) → Camera
Returns a new camera with updated position and rotation.
copyWithViewport({required double newWidth, required double newHeight}) → Camera
Returns a new camera that preserves the current horizontal FOV while changing the viewport size.
focalXForShader() → double
Focal for shader uniforms;
focalYForShader() → double
Y already carries the NDC sign.
invViewRotation3x3() → List<double>
Returns the 3×3 inverse view rotation (camera → world), column-major.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
projectionMatrix() → Matrix4
Column-major OpenGL projection built from intrinsics. Uses ndcYSign to control vertical orientation.
toString() → String
A string representation of this object.
override
viewMatrix() → Matrix4
Returns a column-major OpenGL view matrix (world → camera).

Operators

operator ==(Object other) → bool
The equality operator.
inherited