![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
A quaternion class.
Enumeration of the components raw data index. The components can be accessed by using the [] operator.
Murl.Math.Quaternion.R | The index to the R component. |
Murl.Math.Quaternion.I | The index to the I component. |
Murl.Math.Quaternion.J | The index to the J component. |
Murl.Math.Quaternion.K | The index to the K component. |
Murl.Math.Quaternion.NUM_COMPONENTS | The number of components. |
Enumeration of the components' bit masks
Murl.Math.Quaternion.MASK_NONE | No component |
Murl.Math.Quaternion.MASK_R | R component mask |
Murl.Math.Quaternion.MASK_I | I component mask |
Murl.Math.Quaternion.MASK_J | J component mask |
Murl.Math.Quaternion.MASK_K | K component mask |
Murl.Math.Quaternion.MASK_IJK | Component mask for I, J and K (imaginary part) |
Murl.Math.Quaternion.MASK_ALL | All components |
Enumeration of the predefined initialization types for constructing a Quaternion(PredefinedType type).
Murl.Math.Quaternion.UNINITIALIZED | Create an uninitialized instance. |
Murl.Math.Quaternion.IDENTITY | Initialize with the identity {1, 0, 0, 0}. |
The default constructor.
Murl.Math.Quaternion new()
Constructor to create a quaternion from a predefined type.
Murl.Math.Quaternion new(Murl.Math.Quaternion.PredefinedType type)
type | The predefined type. |
Constructor to initialize a quaternion with given component values.
Murl.Math.Quaternion new(Number vr, Number vi, Number vj, Number vk)
vr | The r component. |
vi | The i component. |
vj | The j component. |
vk | The k component. |
Constructor to initialize a quaternion from a given rotation angle and a normalized axis vector.
Murl.Math.Quaternion new(Number angle, Murl.Math.Vector axis)
angle | The rotation angle. |
axis | The normalized axis vector. |
Constructor to initialize a quaternion from the rotation component of a given 4x4 matrix.
Murl.Math.Quaternion new(Murl.Math.Matrix m)
m | The matrix. |
Constructor to initialize a quaternion from a given 4-vector containing a normalized rotation axis in its x,y and z components, and a rotation angle in its w component.
Murl.Math.Quaternion new(Murl.Math.Vector v)
v | The vector. |
Set all components of the quaternion instance to a set of given component values.
Set(Number vr, Number vi, Number vj, Number vk)
vr | The x-component value to set. |
vi | The y-component value to set. |
vj | The z-component value to set. |
vk | The w-component value to set. |
Set the quaternion from the rotation component of a given 4D matrix.
Set(Murl.Math.Matrix m)
m | The input matrix. |
Copy the content of a source quaternion to the quaternion instance.
Set(Murl.Math.Quaternion q)
q | The quaternion to copy from. |
Clear all components of the quaternion instance. Set all components to default constructor of data type.
Clear()
In-place inversion.
InvertSelf()
In-place addition.
AddSelf(Murl.Math.Quaternion q)
q | The quaternion to add. |
In-place multiplication (scaling).
MultiplySelf(Number d)
d | The value to multiply. |
In-place Quaternion-quaternion multiplication.
MultiplySelf(Murl.Math.Quaternion q)
q | The quaternion to multiply. |
In-place Quaternion-vector multiplication.
MultiplySelf(Murl.Math.Vector v)
v | The vector to multiply. |
In-place normalization of the quaternion instance.
NormalizeSelf()
Get the inverse of a quaternion. This only works for normalized quaternions.
Murl.Math.Quaternion Invert()
Get the addition of a quaternion.
Murl.Math.Quaternion Add(Murl.Math.Quaternion q)
q | The quaternion to add. |
Get the multiplication (scaling).
Murl.Math.Quaternion Multiply(Number d)
d | The value to multiply. |
Get the multiplication with a quaternion.
Murl.Math.Quaternion Multiply(Murl.Math.Quaternion q)
q | The quaternion to multiply. |
Get the multiplication with a vector.
Murl.Math.Quaternion Multiply(Murl.Math.Vector v)
v | The vector to multiply. |
Get the normalization of the quaternion instance.
Murl.Math.Quaternion Normalize()
Interpolate between this instance and a second quaternion. For t=0.0, the result equals the first quaternion, and for t=1.0 the second one.
Murl.Math.Quaternion Interpolate(Murl.Math.Quaternion q, Number t, Boolean spherical)
q | The quaternion to interpolate to. |
t | The interpolation factor. |
spherical | If true, a spherical interpolation is applied. If false, nterpolation is performed in a linear way. |
Check if the quaternion instance is equal to a given second quaternion. Compares all values within the default epsilon range Limits::Epsilon().
Boolean IsEqual(Murl.Math.Quaternion q)
q | The quaternion to compare. |
Check if the quaternion instance is equal to a given second quaternion. Compares all values within a given epsilon range.
Boolean IsEqual(Murl.Math.Quaternion q, Number epsilon)
q | The quaternion to compare. |
epsilon | The epsilon to compare. |
Get the string representation of the object.
String ToString()
Get the number of elements in the object.
Integer GetCount()
The length operator is denoted by the unary prefix operator #.
Converts the object content to a string in a reasonable format.
Get a reference to one of the 4 component values.
index | The component index, see enum Component. |
Addition operator.
Multiplication (scaling) operator
Quaternion-quaternion multiplication operator.
Quaternion-vector multiplication operator.
Equal to comparison operator. Performs a test without an epsilon range, which can be used for detecting changes i.e. DoubleBuffer<Quaternion> class. To compare within an epsilon range use Quaternion::IsEqual().
The R component.
The I component.
The J component.
The K component.