math

lumin. math

Classes

AABB
AABB

Methods

(static) ApplyPosition(a_transform, a_position) → {mat4}

Moves a transform by a given position, and returns the new transform. The transform is assumed
to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_position vec3

Offset to move the transform by.

Returns:

The modified transform.

Type
mat4

(static) ApplyPositionLocal(a_transform, a_position) → {mat4}

Moves a transform by a given position, and returns the new transform. The move is in the local
space of the transform (e.g. moving along the z-axis will perform the move relative to
the transform's local z-axis, not the world z-axis). The transform is assumed to be a view
transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_position vec3

The position to apply to the transform.

Returns:

The modified transform.

Type
mat4

(static) ApplyRotation(a_transform, a_rotation) → {mat4}

Applies a rotation to a transform, and returns the new transform. The transform is assumed
to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_rotation quat

The rotation to apply to the transform.

Returns:

The modified transform.

Type
mat4

(static) ApplyRotationLocal(a_transform, a_rotation) → {mat4}

Applies a rotation to a transform, and returns the new transform. The rotation is in the local
space of the transform (e.g. rotating around the z-axis will perform the rotation relative to
the transform's local z-axis, not the world z-axis). The transform is assumed to be a view
transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_rotation quat

The rotation to apply to the transform.

Returns:

The modified transform.

Type
mat4

(static) ApplyScale(a_transform, a_scale) → {mat4}

Scales a transform by a given amount, and returns the new transform. The transform is assumed
to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_scale vec3

The scale to apply.

Returns:

The modified transform.

Type
mat4

(static) GetPosition(a_transform) → {vec3}

Returns the position component of a transform matrix. The transform is assumed to be a view
transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

Returns:

The position.

Type
vec3

(static) GetRotation(a_transform) → {quat}

Returns the rotation component of a transform matrix. The transform is assumed to be a view
transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

Returns:

The rotation.

Type
quat

(static) GetScale(a_transform) → {vec3}

Returns the scale component of a transform matrix. The transform is assumed to be a view
transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

Returns:

The scale.

Type
vec3

(static) GetViewTransform(a_position, a_rotation, a_scale) → {mat4}

Creates a view transform matrix from position, rotation, and scale components.

Parameters:
Name Type Description
a_position vec3

The position component.

a_rotation quat

The rotation component.

a_scale vec3

The scale component.

Returns:

The new transform.

Type
mat4

(static) SetPosition(a_transform, a_position) → {mat4}

Returns a copy of a transform matrix, with the position component replaced by a new position.
The transform is assumed to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_position vec3

The new position.

Returns:

The modified transform.

Type
mat4

(static) SetRotation(a_transform, a_rotation) → {mat4}

Returns a copy of a transform matrix, with the rotation component replaced by a new rotation.
The transform is assumed to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_rotation quat

The new rotation.

Returns:

The modified transform.

Type
mat4

(static) SetScale(a_transform, a_scale) → {mat4}

Returns a copy of a transform matrix, with the scale component replaced by a new scale. The
transform is assumed to be a view transform (world->camera space).

Parameters:
Name Type Description
a_transform mat4

The transform.

a_scale vec3

The new scale.

Returns:

The modified transform.

Type
mat4