abstract hxmath.math.Quaternion(QuaternionType) from QuaternionType to QuaternionType
Available on all platforms
Quaternion for rotation in 3D.
Class Fields
function conjugate(a:Quaternion):Quaternion
Create a complex conjugate copy of a quaternion (complex/vector portion is negated).
| a | |
| returns | a  | 
function equals(a:Quaternion, b:Quaternion):Bool
Test element-wise equality between two quaternions. False if one of the inputs is null and the other is not.
| a | |
| b | |
| returns | ai == bi  | 
function fromArray(rawData:Array<Float>):Quaternion
Construct a Quaternion from an array.
| rawData | The input array.  | 
| returns | The constructed structure.  | 
function fromAxisAngle(angle:Float, axis:Vector3):Quaternion
Create a quaternion from an axis-angle pair.
| angle | The angle to rotate.  | 
| axis | The axis to rotate around.  | 
| returns | The quaternion.  | 
function notEquals(a:Quaternion, b:Quaternion):Bool
Test inequality between two quaternions.
| a | |
| b | |
| returns | !(ai == bi)  | 
function scalarMultiply(s:Float, a:Quaternion):Quaternion
Multiply a (real) scalar with a quaternion.
| s | |
| a | |
| returns | s * a  | 
function subtract(a:Quaternion, b:Quaternion):Quaternion
Subtract one quaternion from another.
| a | |
| b | |
| returns | a - b  | 
Instance Fields
function new(?s:Float = 1.0f, ?v:Vector3 = null):QuaternionType
Constructor.
| s | Scalar (real) part.  | 
| v | Vector (complex) part.  | 
function addWith(a:Quaternion):Quaternion
Add a quaternion in place. Note: += operator on Haxe abstracts does not behave this way (a new object is returned).
| a | |
| returns | selfi += ai  | 
function applyScalarFunc(func:Float ->Float):Quaternion
Apply a scalar function to each element.
| func | The function to apply.  | 
| returns | The modified object.  | 
function copyTo(other:Quaternion):Void
Copy the contents of this structure to another.
| other | The target structure.  | 
function exp():Quaternion
Get the exponential for the quaternion.
| returns | exp(q) == [cos(theta), v * sin(theta)]  | 
function getArrayElement(i:Int):Float
Get an element by position.
| i | The element index.  | 
| returns | The element.  | 
function rotate(u:Vector3):Vector3
Rotate the given vector, assuming the current quaternion is normalized (if not, normalize first).
| u | The vector to rotate.  | 
| returns | The rotated vector.  | 
function setArrayElement(i:Int, value:Float):Float
Set an element by position.
| i | The element index.  | 
| value | The new value.  | 
| returns | The updated element.  | 
function subtractWith(a:Quaternion):Quaternion
Subtract a quaternion in place. Note: -= operator on Haxe abstracts does not behave this way (a new object is returned).
| a | |
| returns | selfi -= ai  |