Quaternion class

A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = xi + yj + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation. @param x Multiplier of the imaginary basis vector i. @param y Multiplier of the imaginary basis vector j. @param z Multiplier of the imaginary basis vector k. @param w Multiplier of the real part. @see http://en.wikipedia.org/wiki/Quaternion

Constructors

Quaternion([double x = 0, double y = 0, double z = 0, double w = 1])

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
w double
getter/setter pair
x double
getter/setter pair
y double
getter/setter pair
z double
getter/setter pair

Methods

clone() Quaternion
conjugate([Quaternion? target]) Quaternion
Get the quaternion conjugate
copy(Quaternion quat) Quaternion
Copies value of source to this quaternion. @return this
integrate(Vec3 angularVelocity, double dt, Vec3 angularFactor, [Quaternion? target]) Quaternion
Rotate an absolute orientation quaternion given an angular velocity and a time step.
inverse([Quaternion? target]) Quaternion
Get the inverse quaternion rotation.
mult(Quaternion quat, [Quaternion? target]) Quaternion
Multiply the quaternion with an other quaternion.
normalize() Quaternion
Normalize the quaternion. Note that this changes the values of the quaternion.
normalizeFast() Quaternion
Approximation of quaternion normalization. Works best when quat is already almost-normalized. @author unphased, https://github.com/unphased
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(double x, double y, double z, double w) Quaternion
Set the value of the quaternion.
setFromAxisAngle(Vec3 vector, double angle) Quaternion
Set the quaternion components given an axis and an angle in radians.
setFromEuler(double x, double y, double z, [Order order = Order.xyz]) Quaternion
Set the quaternion components given Euler angle representation.
setFromVectors(Vec3 u, Vec3 v) Quaternion
Set the quaternion value given two vectors. The resulting rotation will be the needed rotation to rotate u to v.
slerp(Quaternion toQuat, double t, [Quaternion? target]) Quaternion
Performs a spherical linear interpolation between two quat
toArray() List<double>
Convert to an Array @return x, y, z, w
toAxisAngle(Vec3? targetAxis) AxisAngle
Converts the quaternion to axis, angle representation. @param targetAxis A vector object to reuse for storing the axis. @return An array, first element is the axis and the second is the angle in radians.
toEuler(Vec3 target, [Order order = Order.xyz]) → void
Convert the quaternion to euler angle representation. Order: YZX, as this page describes: https://www.euclideanspace.com/maths/standards/index.htm @param order Three-character string, defaults to "YZX"
toString() String
Convert to a readable format @return "x,y,z,w"
override
vmult(Vec3 v, [Vec3? target]) Vec3
Multiply the quaternion by a vector

Operators

operator ==(Object other) bool
The equality operator.
inherited