A quaternion type. Used for rotations in three dimensions.
Construct a quaternion given its four components. The first argument is the scalar component, the rest are the vector components.
The identity quaternion corresponds to no rotation.
identity == quaternion 1 0 0 0Create a quaternion corresponding to a rotation about the x axis by the given angle. Rotation is counter-clockwise.
q = rotateX (degrees 90)
v = vector 0 1 0 -- y axis
rotateVector q v == vector 0 0 1 -- rotated into z axisCreate a quaternion corresponding to a rotation about the y axis by the given angle.
Create a quaternion corresponding to a rotation about the z axis by the given angle.
Given two vectors, return the quaternion that would rotate the first vector to the second vector. The lengths of the vectors are ignored. If one or both vectors are zero, return the identity quaternion.
Create a quaternion given an axis and angle of rotation. The length of the axis is ignored, but returns Nothing if the axis is the zero vector.
Convert a rotation vector to a quaternion. A rotation vector's direction is the axis of rotation, and its length is the angle of rotation.
Convert a quaternion to a rotation vector.
Multiply two quaternions.
The conjugate of a quaternion.
Rotate a vector by a quaternion.
Convert to a Json Value.
A Json Decoder for vectors encoded with encode.
Convert to an elm-linear-algebra Mat4
Quaternion is a combination of a 3-vector and a scalar.