Cauldron3D.Quat (Cauldron3D v0.2.2)

Copy Markdown View Source

Rotations as unit quaternions {x, y, z, w}.

q = Cauldron3D.Quat.from_euler({0.0, 0.0, :math.pi() / 2})
Cauldron3D.Quat.rotate(q, {1.0, 0.0, 0.0})
#=> {0.0, 1.0, 0.0}

Summary

Functions

The rotation turning x radians about the x axis, then y about the y axis, then z about the z axis.

No rotation.

q scaled to unit length.

vector turned by q.

The rotation t of the way from a to b, along the shorter arc.

The rotation as the rows of a 3 by 3 matrix.

Types

t()

@type t() :: {float(), float(), float(), float()}

Functions

from_euler(arg)

@spec from_euler(Cauldron3D.Vec.t()) :: t()

The rotation turning x radians about the x axis, then y about the y axis, then z about the z axis.

identity()

@spec identity() :: t()

No rotation.

normalize(arg)

@spec normalize(t()) :: t()

q scaled to unit length.

rotate(q, vector)

@spec rotate(t(), Cauldron3D.Vec.t()) :: Cauldron3D.Vec.t()

vector turned by q.

slerp(a, arg, t)

@spec slerp(t(), t(), float()) :: t()

The rotation t of the way from a to b, along the shorter arc.

to_rows(arg)

@spec to_rows(t()) :: {Cauldron3D.Vec.t(), Cauldron3D.Vec.t(), Cauldron3D.Vec.t()}

The rotation as the rows of a 3 by 3 matrix.