e2 docs quaternion - wiremod/wire GitHub Wiki
Quaternion
= quat()
Creates a zero quaternion (1 ops)
= quat(
Real)
Creates a quaternion with real part equal to N (1 ops)
= quat(
C)
Creates a quaternion with real and "i" parts equal to C (1 ops)
= quat(
Imag)
Converts a vector to a quaternion (returns V.xi + V.yj + V.z*k) (1 ops)
= quat(
Real,
I,
J,
K)
Returns N+N2i+N3j+N4k (1 ops)
= quat(
Ang)
Converts A to a quaternion (6 ops)
= quat(
Forward,
Up)
Creates a quaternion given forward (V) and up (V2) vectors (15 ops)
= quat(
Ent)
Converts angle of E to a quaternion (15 ops)
= qi()
Returns quaternion i (1 ops)
= qi(
N)
Returns quaternion N*i (1 ops)
= qj()
Returns j (1 ops)
= qj(
N)
Returns N*j (1 ops)
= qk()
Returns k (1 ops)
= qk(
N)
Returns N*k (1 ops)
= abs(
Q)
Returns absolute value of Q (4 ops)
= conj(
Q)
Returns the conjugate of Q (4 ops)
= inv(
Q)
Returns the inverse of Q (4 ops)
=
:real()
Returns the real component of the quaternion (1 ops)
=
:i()
Returns the i component of the quaternion (1 ops)
=
:j()
Returns the j component of the quaternion (1 ops)
=
:k()
Returns the k component of the quaternion (1 ops)
= exp(
Q)
Raises Euler's constant e to the power Q (7 ops)
= log(
Q)
Calculates natural logarithm of Q (7 ops)
= qMod(
Q)
Changes quaternion Q so that the represented rotation is by an angle between 0 and 180 degrees (by coder0xff) (2 ops)
= slerp(
Q0,
Q1,
T)
Performs spherical linear interpolation between Q and Q2. Returns Q for N=0, Q2 for N=1 (13 ops)
= nlerp(
Q0,
Q1,
T)
Performs linear interpolation between Q and Q2. Returns normalized Q for N=0, Q2 for N=1. (13 ops)
=
:forward()
Returns vector pointing forward for Q (7 ops)
=
:right()
Returns vector pointing right for Q (7 ops)
=
:up()
Returns vector pointing up for Q (7 ops)
= qRotation(
Axis,
Ang)
Returns quaternion for rotation about axis V by angle N (9 ops)
= qRotation(
Rv1)
Construct a quaternion from the rotation vector V. Vector direction is axis of rotation, magnitude is angle in degress (by coder0xff) (9 ops)
= rotationAngle(
Q)
Returns the angle of rotation in degrees (by coder0xff) (9 ops)
= rotationAxis(
Q)
Returns the axis of rotation (by coder0xff) (9 ops)
= rotationVector(
Q)
Returns the rotation vector - rotation axis where magnitude is the angle of rotation in degress (by coder0xff) (9 ops)
= vec(
Q)
Converts Q to a vector by dropping the real component (3 ops)
= matrix(
Q)
Converts Q to a transformation matrix (15 ops)
=
:toAngle()
Returns angle represented by Q (15 ops)
=
:normalized()
Returns new normalized quaternion for Q (15 ops)
=
:dot(
Q1)
Returns dot product of Q with Q2 (15 ops)
= toString(
Q)
Formats Q as a string (15 ops)
=
:toString()
Formats Q as a string (15 ops)