| Package | graphics.geom |
| Class | public class Quaternion |
| Inheritance | Quaternion Object |
| Implements | Geometry |
xi + yj + zk + w.
| Property | Defined By | ||
|---|---|---|---|
| w : Number
Represents the scalar value of the quaternion. | Quaternion | ||
| x : Number
Defined the x component of the quaternion. | Quaternion | ||
| y : Number
Defined the y component of the quaternion. | Quaternion | ||
| z : Number
Defined the z component of the quaternion. | Quaternion | ||
| Method | Defined By | ||
|---|---|---|---|
Quaternion(x:Number = 0, y:Number = 0, z:Number = 0, w:Number = 0)
Creates a new Quaternion instance. | Quaternion | ||
add(q:Quaternion):void
Adds the values of the specified Quaternion. | Quaternion | ||
axis(x:Number, y:Number, z:Number, angle:Number):void
Sets the quaternion with values representing the given rotation around a vector. | Quaternion | ||
clone():*
Returns a shallow copy of this instance. | Quaternion | ||
conjugate():void
Conjugates the Quaternion. | Quaternion | ||
dot(q:Quaternion):Number
Returns the dot product of two quaternions. | Quaternion | ||
equals(o:*):Boolean
Compares the specified object with this object for equality. | Quaternion | ||
euler(roll:Number, pitch:Number, yaw:Number, degrees:Boolean = false):void
Sets the quaternion with values representing the given euler rotation. | Quaternion | ||
Calculates the exponential of a quaternion. | Quaternion | ||
getEulerAngles(degrees:Boolean = false):Vector3
Returns the Vector3 representation of the roll/pitch/yaw euler angles of the current quaternion. | Quaternion | ||
identity():void
Sets the Quaternion to be identity {0,0,0,1}. | Quaternion | ||
invert():void
Conjugates and renormalizes a quaternion. | Quaternion | ||
isIdentity():Boolean
Returns true if the Quaternion is {0,0,0,1}. | Quaternion | ||
Calculates the natural logarithm of a quaternion. | Quaternion | ||
multiply(q:Quaternion):void
Multiply the Quaternion with an other Quaternion. | Quaternion | ||
normalize():void
Normalizes the Quaternion instance. | Quaternion | ||
scale(value:Number):void
Scales the quaternion object with the input value. | Quaternion | ||
size():Number
Returns the magnitude (length) of a Quaternion, measured in the Euclidean norm. | Quaternion | ||
sizeSquared():Number
Returns the square of the length of a quaternion. | Quaternion | ||
substract(q:Quaternion):void
Substracts the values of the s2ecified Quaternion. | Quaternion | ||
toObject():Object
Returns the Object representation of this object. | Quaternion | ||
toSource(indent:int = 0):String
Returns the source code string representation of the object. | Quaternion | ||
toString():String
Returns the string representation of the object. | Quaternion | ||
unaryNegation():void
Apply the negation of the quaternion. | Quaternion | ||
| w | property |
public var w:NumberRepresents the scalar value of the quaternion.
| x | property |
public var x:NumberDefined the x component of the quaternion.
| y | property |
public var y:NumberDefined the y component of the quaternion.
| z | property |
public var z:NumberDefined the z component of the quaternion.
| Quaternion | () | Constructor |
public function Quaternion(x:Number = 0, y:Number = 0, z:Number = 0, w:Number = 0)
Creates a new Quaternion instance.
x:Number (default = 0) — the x coordinate.
| |
y:Number (default = 0) — the y coordinate.
| |
z:Number (default = 0) — the z coordinate.
| |
w:Number (default = 0) — the transform component of the quaternion.
|
| add | () | method |
public function add(q:Quaternion):voidAdds the values of the specified Quaternion.
Parameters
q:Quaternion |
| axis | () | method |
public function axis(x:Number, y:Number, z:Number, angle:Number):voidSets the quaternion with values representing the given rotation around a vector.
Parameters
x:Number — The x value of the rotation vector.
| |
y:Number — The y value of the rotation vector.
| |
z:Number — The z value of the rotation vector.
| |
angle:Number — The angle in radians of the rotation.
|
| clone | () | method |
public function clone():*Returns a shallow copy of this instance.
Returns* — a shallow copy of this instance.
|
| conjugate | () | method |
public function conjugate():voidConjugates the Quaternion.
| dot | () | method |
public function dot(q:Quaternion):NumberReturns the dot product of two quaternions.
Parameters
q:Quaternion — The quaternion to calculate the dot product.
|
Number — The dot product of the two quaternions.
|
| equals | () | method |
public function equals(o:*):BooleanCompares the specified object with this object for equality.
Parameters
o:* |
Boolean — true if the the specified object is equal with this object.
|
| euler | () | method |
public function euler(roll:Number, pitch:Number, yaw:Number, degrees:Boolean = false):voidSets the quaternion with values representing the given euler rotation.
Note : that we are applying in order: pitch, yaw, roll but we've ordered them in x, y, and z for convenience.
Example :
import graphics.geom.Quaternion ;
import graphics.numeric.Trigo ;
var q:Quaternion = new Quaternion();
q.euler( 360 * DEG2RAD , 180 * DEG2RAD , 90 * DEG2RAD ) ;
trace(q) ;
trace(q.getEulerAngles(true) ) ;
q.euler( 360, 180 , 90 , true ) ;
trace(q) ;
trace(q.getEulerAngles(true) ) ;
q.euler(40,80,180,true) ;
trace(q) ;
trace(q.getEulerAngles(true) ) ;
q.euler( 2 Math.PI , Math.PI , Math.PI / 2 ) ;
trace(q.getEulerAngles(true) ) ;
Parameters
roll:Number — The angle of the rotation around the y axis (heading/azimuth/θ).
| |
pitch:Number — The angle of the rotation around the z axis (attitude/elevation/φ).
| |
yaw:Number — The angle of the rotation around the x axis (bank/tilt/ψ).
| |
degrees:Boolean (default = false) — Indicates if the angle are in degrees or in radians (default).
|
| exp | () | method |
public function exp():QuaternionCalculates the exponential of a quaternion.
ReturnsQuaternion — The new Quaternion reference.
|
| getEulerAngles | () | method |
public function getEulerAngles(degrees:Boolean = false):Vector3Returns the Vector3 representation of the roll/pitch/yaw euler angles of the current quaternion.
Note :
roll = Heading = rotation about y axis
pitch = Attitude = rotation about z axis
yaw = Bank = rotation about x axis
used in this class : Standards
Parameters
degrees:Boolean (default = false) |
Vector3 — the Vector3 representation of the roll/pitch/yaw euler angles of the current quaternion.
|
| identity | () | method |
public function identity():voidSets the Quaternion to be identity {0,0,0,1}.
| invert | () | method |
public function invert():voidConjugates and renormalizes a quaternion.
| isIdentity | () | method |
public function isIdentity():Boolean
Returns true if the Quaternion is {0,0,0,1}.
Boolean — true if this Quaternion is {0,0,0,1}.
|
| log | () | method |
public function log():QuaternionCalculates the natural logarithm of a quaternion.
ReturnsQuaternion — The new Quaternion reference.
|
| multiply | () | method |
public function multiply(q:Quaternion):voidMultiply the Quaternion with an other Quaternion.
Parameters
q:Quaternion — The Quaternion to multiply with the current Quaternion object.
|
| normalize | () | method |
public function normalize():voidNormalizes the Quaternion instance.
| scale | () | method |
public function scale(value:Number):voidScales the quaternion object with the input value.
Parameters
value:Number — a real number to scale the current quaternion object.
|
| size | () | method |
public function size():NumberReturns the magnitude (length) of a Quaternion, measured in the Euclidean norm.
ReturnsNumber — The length of the quaternion.
|
| sizeSquared | () | method |
public function sizeSquared():NumberReturns the square of the length of a quaternion.
ReturnsNumber — the square of the length of a quaternion.
|
| substract | () | method |
public function substract(q:Quaternion):voidSubstracts the values of the s2ecified Quaternion.
Parameters
q:Quaternion |
| toObject | () | method |
public function toObject():ObjectReturns the Object representation of this object.
ReturnsObject — the Object representation of this object.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source code string representation of the object.
Parameters
indent:int (default = 0) |
String — the source code string representation of the object.
|
| toString | () | method |
public function toString():StringReturns the string representation of the object.
ReturnsString — the string representation of the object.
|
| unaryNegation | () | method |
public function unaryNegation():voidApply the negation of the quaternion.