Class Quaternion
Hierarchy
- Quaternion
Index
Constructors
Accessors
Methods
- add
- add
InPlace - as
Array - clone
- conjugate
- conjugate
InPlace - conjugate
ToRef - copy
From - copy
From Floats - equals
- equals
With Epsilon - from
Rotation Matrix - get
Class Name - get
Hash Code - length
- multiply
- multiply
InPlace - multiply
ToRef - normalize
- scale
- scale
And Add ToRef - scale
InPlace - scale
ToRef - set
- subtract
- to
Euler Angles - to
Euler Angles ToRef - to
Rotation Matrix - to
String - Are
Close - Dot
- From
Array - From
Array ToRef - From
Euler Angles - From
Euler Angles ToRef - From
Euler Vector - From
Euler Vector ToRef - From
Rotation Matrix - From
Rotation Matrix ToRef - Hermite
- Identity
- Inverse
- Inverse
ToRef - Is
Identity - Rotation
Alpha Beta Gamma - Rotation
Alpha Beta Gamma ToRef - Rotation
Axis - Rotation
Axis ToRef - Rotation
Quaternion From Axis - Rotation
Quaternion From Axis ToRef - Rotation
Yaw Pitch Roll - Rotation
Yaw Pitch Roll ToRef - Slerp
- Slerp
ToRef - Zero
Constructors
constructor
-
Creates a new Quaternion from the given floats
Parameters
-
Optional x: number
defines the first component (0 by default)
-
Optional y: number
defines the second component (0 by default)
-
Optional z: number
defines the third component (0 by default)
-
Optional w: number
defines the fourth component (1.0 by default)
Returns Quaternion
-
Accessors
w
-
Gets or sets the w coordinate
Returns number
-
Gets or sets the w coordinate
Parameters
-
value: number
Returns any
-
x
-
Gets or sets the x coordinate
Returns number
-
Gets or sets the x coordinate
Parameters
-
value: number
Returns any
-
y
-
Gets or sets the y coordinate
Returns number
-
Gets or sets the y coordinate
Parameters
-
value: number
Returns any
-
z
-
Gets or sets the z coordinate
Returns number
-
Gets or sets the z coordinate
Parameters
-
value: number
Returns any
-
Methods
addSearch playground for add
-
Adds two quaternions
Parameters
-
other: DeepImmutable<Quaternion>
defines the second operand
Returns Quaternion
a new quaternion as the addition result of the given one and the current quaternion
-
add InPlaceSearch playground for addInPlace
-
Add a quaternion to the current one
Parameters
-
other: DeepImmutable<Quaternion>
defines the quaternion to add
Returns Quaternion
the current quaternion
-
as ArraySearch playground for asArray
-
Copy the quaternion to an array
Returns number[]
a new array populated with 4 elements from the quaternion coordinates
cloneSearch playground for clone
-
Clone the current quaternion
Returns Quaternion
a new quaternion copied from the current one
conjugateSearch playground for conjugate
-
Conjugates in place (1-q) the current quaternion
Returns Quaternion
a new quaternion
conjugate InPlaceSearch playground for conjugateInPlace
-
Conjugates in place (1-q) the current quaternion
Returns Quaternion
the current updated quaternion
conjugate ToRefSearch playground for conjugateToRef
-
Conjugates (1-q) the current quaternion and stores the result in the given quaternion
Parameters
-
ref: Quaternion
defines the target quaternion
Returns Quaternion
the current quaternion
-
copy FromSearch playground for copyFrom
-
Copy a quaternion to the current one
Parameters
-
other: DeepImmutable<Quaternion>
defines the other quaternion
Returns Quaternion
the updated current quaternion
-
copy From FloatsSearch playground for copyFromFloats
-
Updates the current quaternion with the given float coordinates
Parameters
-
x: number
defines the x coordinate
-
y: number
defines the y coordinate
-
z: number
defines the z coordinate
-
w: number
defines the w coordinate
Returns Quaternion
the updated current quaternion
-
equalsSearch playground for equals
-
Check if two quaternions are equals
Parameters
-
otherQuaternion: DeepImmutable<Quaternion>
defines the second operand
Returns boolean
true if the current quaternion and the given one coordinates are strictly equals
-
equals With EpsilonSearch playground for equalsWithEpsilon
-
Gets a boolean if two quaternions are equals (using an epsilon value)
Parameters
-
otherQuaternion: DeepImmutable<Quaternion>
defines the other quaternion
-
Optional epsilon: number
defines the minimal distance to consider equality
Returns boolean
true if the given quaternion coordinates are close to the current ones by a distance of epsilon.
-
from Rotation MatrixSearch playground for fromRotationMatrix
-
Updates the current quaternion from the given rotation matrix values
Parameters
-
matrix: DeepImmutable<Matrix>
defines the source matrix
Returns Quaternion
the current updated quaternion
-
get Class NameSearch playground for getClassName
-
Gets the class name of the quaternion
Returns string
the string "Quaternion"
get Hash CodeSearch playground for getHashCode
-
Gets a hash code for this quaternion
Returns number
the quaternion hash code
lengthSearch playground for length
-
Gets length of current quaternion
Returns number
the quaternion length (float)
multiplySearch playground for multiply
-
Multiplies two quaternions
Parameters
-
q1: DeepImmutable<Quaternion>
defines the second operand
Returns Quaternion
a new quaternion set as the multiplication result of the current one with the given one "q1"
-
multiply InPlaceSearch playground for multiplyInPlace
-
Updates the current quaternion with the multiplication of itself with the given one "q1"
Parameters
-
q1: DeepImmutable<Quaternion>
defines the second operand
Returns Quaternion
the currentupdated quaternion
-
multiply ToRefSearch playground for multiplyToRef
-
Sets the given "result" as the the multiplication result of the current one with the given one "q1"
Parameters
-
q1: DeepImmutable<Quaternion>
defines the second operand
-
result: Quaternion
defines the target quaternion
Returns Quaternion
the current quaternion
-
normalizeSearch playground for normalize
-
Normalize in place the current quaternion
Returns Quaternion
the current updated quaternion
scaleSearch playground for scale
-
Multiplies the current quaternion by a scale factor
Parameters
-
value: number
defines the scale factor
Returns Quaternion
a new quaternion set by multiplying the current quaternion coordinates by the float "scale"
-
scale And Add ToRefSearch playground for scaleAndAddToRef
-
Scale the current quaternion values by a factor and add the result to a given quaternion
Parameters
-
scale: number
defines the scale factor
-
result: Quaternion
defines the Quaternion object where to store the result
Returns Quaternion
the unmodified current quaternion
-
scale InPlaceSearch playground for scaleInPlace
-
Multiplies in place the current quaternion by a scale factor
Parameters
-
value: number
defines the scale factor
Returns Quaternion
the current modified quaternion
-
scale ToRefSearch playground for scaleToRef
-
Scale the current quaternion values by a factor and stores the result to a given quaternion
Parameters
-
scale: number
defines the scale factor
-
result: Quaternion
defines the Quaternion object where to store the result
Returns Quaternion
the unmodified current quaternion
-
setSearch playground for set
-
Updates the current quaternion from the given float coordinates
Parameters
-
x: number
defines the x coordinate
-
y: number
defines the y coordinate
-
z: number
defines the z coordinate
-
w: number
defines the w coordinate
Returns Quaternion
the updated current quaternion
-
subtractSearch playground for subtract
-
Subtract two quaternions
Parameters
-
other: Quaternion
defines the second operand
Returns Quaternion
a new quaternion as the subtraction result of the given one from the current one
-
to Euler AnglesSearch playground for toEulerAngles
-
Returns a new Vector3 set with the Euler angles translated from the current quaternion
Parameters
-
Optional order: string
is a reserved parameter and is ignored for now
Returns Vector3
a new Vector3 containing the Euler angles
-
to Euler Angles ToRefSearch playground for toEulerAnglesToRef
-
Sets the given vector3 "result" with the Euler angles translated from the current quaternion
Parameters
-
result: Vector3
defines the vector which will be filled with the Euler angles
Returns Quaternion
the current unchanged quaternion
-
to Rotation MatrixSearch playground for toRotationMatrix
-
Updates the given rotation matrix with the current quaternion values
Parameters
-
result: Matrix
defines the target matrix
Returns Quaternion
the current unchanged quaternion
-
to StringSearch playground for toString
-
Gets a string representation for the current quaternion
Returns string
a string with the Quaternion coordinates
Static Are CloseSearch playground for AreClose
-
Checks if the two quaternions are close to each other
Parameters
-
quat0: DeepImmutable<Quaternion>
defines the first quaternion to check
-
quat1: DeepImmutable<Quaternion>
defines the second quaternion to check
Returns boolean
true if the two quaternions are close to each other
-
Static DotSearch playground for Dot
-
Returns the dot product (float) between the quaternions "left" and "right"
Parameters
-
left: DeepImmutable<Quaternion>
defines the left operand
-
right: DeepImmutable<Quaternion>
defines the right operand
Returns number
the dot product
-
Static From ArraySearch playground for FromArray
-
Creates a new quaternion from data stored into an array
Parameters
-
array: DeepImmutable<ArrayLike<number>>
defines the data source
-
Optional offset: number
defines the offset in the source array where the data starts
Returns Quaternion
a new quaternion
-
Static From Array ToRefSearch playground for FromArrayToRef
-
Updates the given quaternion "result" from the starting index of the given array.
Parameters
-
array: DeepImmutable<ArrayLike<number>>
the array to pull values from
-
offset: number
the offset into the array to start at
-
result: Quaternion
the quaternion to store the result in
Returns void
-
Static From Euler AnglesSearch playground for FromEulerAngles
-
Create a quaternion from Euler rotation angles
Parameters
-
x: number
Pitch
-
y: number
Yaw
-
z: number
Roll
Returns Quaternion
the new Quaternion
-
Static From Euler Angles ToRefSearch playground for FromEulerAnglesToRef
-
Updates a quaternion from Euler rotation angles
Parameters
-
x: number
Pitch
-
y: number
Yaw
-
z: number
Roll
-
result: Quaternion
the quaternion to store the result
Returns Quaternion
the updated quaternion
-
Static From Euler VectorSearch playground for FromEulerVector
-
Create a quaternion from Euler rotation vector
Parameters
-
vec: DeepImmutable<Vector3>
the Euler vector (x Pitch, y Yaw, z Roll)
Returns Quaternion
the new Quaternion
-
Static From Euler Vector ToRefSearch playground for FromEulerVectorToRef
-
Updates a quaternion from Euler rotation vector
Parameters
-
vec: DeepImmutable<Vector3>
the Euler vector (x Pitch, y Yaw, z Roll)
-
result: Quaternion
the quaternion to store the result
Returns Quaternion
the updated quaternion
-
Static From Rotation MatrixSearch playground for FromRotationMatrix
-
Creates a new quaternion from a rotation matrix
Parameters
-
matrix: DeepImmutable<Matrix>
defines the source matrix
Returns Quaternion
a new quaternion created from the given rotation matrix values
-
Static From Rotation Matrix ToRefSearch playground for FromRotationMatrixToRef
-
Updates the given quaternion with the given rotation matrix values
Parameters
-
matrix: DeepImmutable<Matrix>
defines the source matrix
-
result: Quaternion
defines the target quaternion
Returns void
-
Static HermiteSearch playground for Hermite
-
Interpolate between two quaternions using Hermite interpolation
Parameters
-
value1: DeepImmutable<Quaternion>
defines first quaternion
-
tangent1: DeepImmutable<Quaternion>
defines the incoming tangent
-
value2: DeepImmutable<Quaternion>
defines second quaternion
-
tangent2: DeepImmutable<Quaternion>
defines the outgoing tangent
-
amount: number
defines the target quaternion
Returns Quaternion
the new interpolated quaternion
-
Static IdentitySearch playground for Identity
-
Creates an identity quaternion
Returns Quaternion
the identity quaternion
Static InverseSearch playground for Inverse
-
Inverse a given quaternion
Parameters
-
q: DeepImmutable<Quaternion>
defines the source quaternion
Returns Quaternion
a new quaternion as the inverted current quaternion
-
Static Inverse ToRefSearch playground for InverseToRef
-
Inverse a given quaternion
Parameters
-
q: Quaternion
defines the source quaternion
-
result: Quaternion
the quaternion the result will be stored in
Returns Quaternion
the result quaternion
-
Static Is IdentitySearch playground for IsIdentity
-
Gets a boolean indicating if the given quaternion is identity
Parameters
-
quaternion: DeepImmutable<Quaternion>
defines the quaternion to check
Returns boolean
true if the quaternion is identity
-
Static Rotation Alpha Beta GammaSearch playground for RotationAlphaBetaGamma
-
Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation
Parameters
-
alpha: number
defines the rotation around first axis
-
beta: number
defines the rotation around second axis
-
gamma: number
defines the rotation around third axis
Returns Quaternion
the new quaternion
-
Static Rotation Alpha Beta Gamma ToRefSearch playground for RotationAlphaBetaGammaToRef
-
Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion
Parameters
-
alpha: number
defines the rotation around first axis
-
beta: number
defines the rotation around second axis
-
gamma: number
defines the rotation around third axis
-
result: Quaternion
defines the target quaternion
Returns void
-
Static Rotation AxisSearch playground for RotationAxis
-
Creates a quaternion from a rotation around an axis
Parameters
-
axis: DeepImmutable<Vector3>
defines the axis to use
-
angle: number
defines the angle to use
Returns Quaternion
a new quaternion created from the given axis (Vector3) and angle in radians (float)
-
Static Rotation Axis ToRefSearch playground for RotationAxisToRef
-
Creates a rotation around an axis and stores it into the given quaternion
Parameters
-
axis: DeepImmutable<Vector3>
defines the axis to use
-
angle: number
defines the angle to use
-
result: Quaternion
defines the target quaternion
Returns Quaternion
the target quaternion
-
Static Rotation Quaternion From AxisSearch playground for RotationQuaternionFromAxis
-
Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)
Parameters
-
axis1: DeepImmutable<Vector3>
defines the first axis
-
axis2: DeepImmutable<Vector3>
defines the second axis
-
axis3: DeepImmutable<Vector3>
defines the third axis
Returns Quaternion
the new quaternion
-
Static Rotation Quaternion From Axis ToRefSearch playground for RotationQuaternionFromAxisToRef
-
Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion
Parameters
-
axis1: DeepImmutable<Vector3>
defines the first axis
-
axis2: DeepImmutable<Vector3>
defines the second axis
-
axis3: DeepImmutable<Vector3>
defines the third axis
-
ref: Quaternion
defines the target quaternion
Returns void
-
Static Rotation Yaw Pitch RollSearch playground for RotationYawPitchRoll
-
Creates a new quaternion from the given Euler float angles (y, x, z)
Parameters
-
yaw: number
defines the rotation around Y axis
-
pitch: number
defines the rotation around X axis
-
roll: number
defines the rotation around Z axis
Returns Quaternion
the new quaternion
-
Static Rotation Yaw Pitch Roll ToRefSearch playground for RotationYawPitchRollToRef
-
Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
Parameters
-
yaw: number
defines the rotation around Y axis
-
pitch: number
defines the rotation around X axis
-
roll: number
defines the rotation around Z axis
-
result: Quaternion
defines the target quaternion
Returns void
-
Static SlerpSearch playground for Slerp
-
Interpolates between two quaternions
Parameters
-
left: DeepImmutable<Quaternion>
defines first quaternion
-
right: DeepImmutable<Quaternion>
defines second quaternion
-
amount: number
defines the gradient to use
Returns Quaternion
the new interpolated quaternion
-
Static Slerp ToRefSearch playground for SlerpToRef
-
Interpolates between two quaternions and stores it into a target quaternion
Parameters
-
left: DeepImmutable<Quaternion>
defines first quaternion
-
right: DeepImmutable<Quaternion>
defines second quaternion
-
amount: number
defines the gradient to use
-
result: Quaternion
defines the target quaternion
Returns void
-
Static ZeroSearch playground for Zero
-
Creates an empty quaternion
Returns Quaternion
a new quaternion set to (0.0, 0.0, 0.0)
Class used to store quaternion data
https://en.wikipedia.org/wiki/Quaternion
https://doc.babylonjs.com/features/position,_rotation,_scaling