Matrix4
classin packageklyn.math.geometry
public final class Matrix4
Matrix4

Immutable 4x4 matrix, column-major, acting on column vectors. a * b applies b first. Coordinates are right-handed; angles are radians. Example: m = Matrix4.translation(1.0, 0.0, 0.0) * Matrix4.scaling(2.0, 2.0, 2.0)

Properties
Modifier and Type Member Description
public readonly property isIdentity
isIdentity as Boolean
Whether this is exactly the identity matrix, O(1).
Constructors
Modifier and Type Member Description
public Matrix4
Matrix4(values as IList<Double> = null)
Copies sixteen column-major elements, or constructs identity.
Methods
Modifier and Type Member Description
public at
at(row as Int, column as Int) as Double
Reads an element, row/column in [0,3].
public static lookAt
lookAt(eye as Vector3d<Double>, target as Vector3d<Double>, up as Vector3d<Double>) as Matrix4
World-to-camera matrix, camera looks from eye toward target.
public static perspective
perspective(verticalAngle as Double, aspect as Double, near as Double, far as Double) as Matrix4
Perspective projection (OpenGL depth [-1,1]); vertical angle in radians.
public static rotation
rotation(rotation as Rotation3d) as Matrix4
Converts a unit quaternion to a rotation matrix.
public static scaling
scaling(x as Double, y as Double, z as Double) as Matrix4
Scaling matrix; zero scales are permitted for CPU algebra.
public transformNormal
transformNormal(normal as Vector3d<Double>) as Vector3d<Double>
Transforms a surface normal by the inverse transpose and normalizes it.
public transformPoint
transformPoint(point as Vector3d<Double>) as Vector3d<Double>
Transforms a point including homogeneous division.
public static translation
translation(x as Double, y as Double, z as Double) as Matrix4
Translation matrix.
public writeTo
writeTo(target as Float[], offset as Int = 0) as Void
Writes sixteen Float values into caller-owned storage, O(1).
Operators
Modifier and Type Member Description
public static operator*(a as Matrix4, b as Matrix4) as Matrix4 Matrix product.