{ x, y, z, w }
Static variables
staticeuler:Quaternion
input/output euler as rotation angles around x, y, z axis ( as faux Quaternion ), but set /gets internally as the Quaternion value
staticread onlyunit:Quaternion
>>> Quaternion.unit == new Quaternion({ x: 1., y: 1., z: 1., w: 1. })
staticread onlyunitNormal:Quaternion
>>> ({
... var q = new Quaternion( { x: 1., y: 1., z: 1., w: 1. } );
... Quaternion.unitNormal == q.normalize();
... }) == true
staticread onlyzero:Quaternion
>>> Quaternion.zero == new Quaternion({ x: 0., y: 0., z: 0., w: 0. })
staticread onlyzeroNormal:Quaternion
>>> Quaternion.zeroNormal == new Quaternion({ x: 0., y: 0., z: 0., w: 1. })
Static methods
staticinlineadd(a:Quaternion, b:Quaternion):Quaternion
>>> ({
... var a = Quaternion.unit;
... a + a == new Quaternion({ x: 2., y: 2., z: 2., w: 2. });
... }) == true
staticinlineconjugate(a:Quaternion):Quaternion
>>> ({
... var a = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... var b = ~a;
... b == new Quaternion({ x: -1., y: -2., z: -3., w: 1. }); }) == true
staticinlinecopy(pin:Quaternion, pout:Quaternion):Quaternion
>>> ({
... var a = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... var b = Quaternion.zero;
... var c = Quaternion.copy( a, b );
... a == c; }) == true
staticinlinedistanceZeroOne(this:Mat1x4, q:Quaternion):Float
provides a distance measure between Quaternions between 1 ( Math.PI ) and 0 ( 0 );
staticinlineequal(a:Quaternion, b:Quaternion):Bool
>>> ({
... var a = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... var b = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... a == b; }) == true
staticinlinefromArray(arr:Array<Float>):Quaternion
>>> ({
... var a = Quaternion.unit;
... var b: Quaternion = [ 1., 1., 1., 1. ];
... Equal.equals( a, b ); }) == true
staticinlinefromMatrix3x3(m:Matrix3x3):Quaternion
staticinlinefromMatrix4x3(m4x3:Matrix4x3):Quaternion
staticinlinefromVec(vec:Vector<Float>):Quaternion
>>> ({
... var a = Quaternion.unit;
... var b = haxe.ds.Vector.fromArrayCopy([ 1., 1., 1., 1. ]);
... var c: Quaternion = b;
... a == b; }) == true
staticinlinefromYawPitchRoll(yaw:Float, pitch:Float, roll:Float):Quaternion
used to set yaw pitch and roll ( very similar to set euler ) but static.
* x: Pitch
* y: Yaw
* z: Roll
staticinlineidentity(out:Quaternion):Quaternion
>>> ({
... var a = Quaternion.identity( Quaternion.zero );
... var b = Quaternion.zeroNormal;
... a == b; }) == true
staticlookAt(this:Mat1x4, target:Matrix1x4, current:Matrix1x4, eye:Matrix1x4, up:Matrix1x4):Quaternion
staticinlinenegate(a:Quaternion):Quaternion
>>> ({
... var a = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... var b = -a;
... b == new Quaternion({ x: -1., y: -2., z: -3., w: -1. }); }) == true
staticinlinenotEqual(a:Quaternion, b:Quaternion):Bool
>>> ({
... var a = new Quaternion({ x: 1., y: 2., z: 3., w: 1. });
... var b = new Quaternion({ x: 1., y: 2., z: 4., w: 1. });
... a != b; }) == true
staticinlinesubtract(a:Quaternion, b:Quaternion):Quaternion
>>> ({
... var a = Quaternion.unit;
... a - a == Quaternion.zero;
... }) == true
staticinlinetoArray(this:Mat1x4):Array<Float>
>>> ({
... var a = Quaternion.unit;
... var b: Array = a;
... Equal.equals( b, [ 1., 1., 1., 1. ] ); }) == true