OffAxisProjection class Scene graph

A pinhole projection whose four frustum edges are given separately, so the view axis need not sit in the middle of the image.

A headset lens, a window in a wall seen from one side, a camera whose intrinsics put the principal point off centre, and each half of a stereo pair all have this shape; PerspectiveProjection is the symmetric case.

The edges are tangents of the half-angles from the view axis, signed along the view's right and up axes, so tanLeft and tanDown are negative for a frustum that contains its own axis. OpenXR's XrFovf carries the same four values as angles (OffAxisProjection.fromAngles); WebXR and ARKit hand over the finished matrix (OffAxisProjection.fromMatrix).

The aspect ratio a view renders at is ignored. The tangents already fix the frustum's shape, and a viewport that does not match them stretches the image, which is what a frustum stated by a runtime wants.

Inheritance

Constructors

OffAxisProjection({required double tanLeft, required double tanRight, required double tanDown, required double tanUp, double near = 0.1, double far = 1000.0})
Creates a projection from four signed edge tangents and a clip range.
OffAxisProjection.fromAngles({required double left, required double right, required double down, required double up, double near = 0.1, double far = 1000.0})
From half-angles in radians measured from the view axis, left and down negative, the way OpenXR's XrFovf states them.
factory
OffAxisProjection.fromMatrix(Matrix4 matrix, {double? near, double? far})
Reads the edges and clip planes back out of a perspective matrix.
factory
OffAxisProjection.symmetric({double fovRadiansY = 45 * degrees2Radians, double aspectRatio = 1.0, double near = 0.1, double far = 1000.0})
The frustum a PerspectiveProjection of fovRadiansY rendered at aspectRatio has, for a symmetric view through this class.
factory

Properties

aspectRatio → double
The frustum's width over its height, which a viewport should match.
no setter
far ↔ double
Distance to the far clipping plane, or double.infinity.
getter/setter pair
fovRadiansX → double
The horizontal angle of a symmetric lens covering the same width.
no setter
fovRadiansY → double
The vertical angle of a symmetric lens covering the same height, for anything that sizes against the frame (level-of-detail selection).
no setter
hashCode → int
The hash code for this object.
no setterinherited
near ↔ double
Distance to the near clipping plane. See PerspectiveProjection.near for how it trades against depth precision.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tanDown ↔ double
Tangent of the angle from the view axis to the bottom edge, negative when the edge is below the axis.
getter/setter pair
tanLeft ↔ double
Tangent of the angle from the view axis to the left edge, negative when the edge is left of the axis.
getter/setter pair
tanRight ↔ double
Tangent of the angle from the view axis to the right edge.
getter/setter pair
tanUp ↔ double
Tangent of the angle from the view axis to the top edge.
getter/setter pair

Methods

getProjectionMatrix(double aspectRatio, {Vector2? jitter}) → Matrix4
Returns the projection matrix for a render target of the given aspectRatio (width / height).
override
getProjectionMatrixForViewport(Size viewportSize, {Vector2? jitter}) → Matrix4
Returns the projection matrix for a view viewportSize in logical pixels.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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