Home > decentraland-ecs > Quaternion
Class used to store quaternion data https://en.wikipedia.org/wiki/Quaternion http://doc.babylonjs.com/features/position,_rotation,_scaling
Property | Access Modifier | Type | Description |
---|---|---|---|
eulerAngles |
Vector3 |
Sets the euler angle representation of the rotation. | |
Identity |
Quaternion |
Creates an identity quaternion | |
length |
number |
Gets length of current quaternion | |
lengthSquared |
number |
Gets length of current quaternion | |
normalized |
Quaternion |
Converts this quaternion to one with the same orientation but with a magnitude of 1. | |
w |
number |
defines the fourth component (1.0 by default) | |
x |
number |
defines the first component (0 by default) | |
y |
number |
defines the second component (0 by default) | |
z |
number |
defines the third component (0 by default) |
Method | Access Modifier | Returns | Description |
---|---|---|---|
constructor(x, y, z, w) |
Creates a new Quaternion from the given floats | ||
Angle(quat1, quat2) |
number |
Returns the angle in degrees between two rotations a and b. | |
angleAxis(degress, axis) |
Quaternion |
||
AreClose(quat0, quat1) |
boolean |
Checks if the two quaternions are close to each other | |
asArray() |
number[] |
Copy the quaternion to an array | |
clone() |
Quaternion |
Clone the current quaternion | |
conjugate() |
Quaternion |
Conjugates in place (1-q) the current quaternion | |
conjugateInPlace() |
Quaternion |
Conjugates in place (1-q) the current quaternion | |
conjugateToRef(ref) |
Quaternion |
Conjugates (1-q) the current quaternion and stores the result in the given quaternion | |
copyFrom(other) |
Quaternion |
Copy a quaternion to the current one | |
copyFromFloats(x, y, z, w) |
Quaternion |
Updates the current quaternion with the given float coordinates | |
Dot(left, right) |
number |
Returns the dot product (float) between the quaternions "left" and "right" | |
equals(otherQuaternion) |
boolean |
Check if two quaternions are equals | |
Euler(x, y, z) |
Quaternion |
Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis. | |
FromArray(array, offset) |
Quaternion |
Creates a new quaternion from data stored into an array | |
FromEulerAnglesRef(x, y, z, result) |
void |
Creates a new quaternion from a set of euler angles and stores it in the target quaternion | |
fromRotationMatrix(matrix) |
Quaternion |
Updates the current quaternion from the given rotation matrix values | |
FromRotationMatrix(matrix) |
Quaternion |
Creates a new quaternion from a rotation matrix | |
FromRotationMatrixToRef(matrix, result) |
void |
Updates the given quaternion with the given rotation matrix values | |
FromToRotation(from, to) |
Quaternion |
Creates a rotation which rotates from fromDirection to toDirection. | |
getClassName() |
string |
Gets the class name of the quaternion | |
getHashCode() |
number |
Gets a hash code for this quaternion | |
Hermite(value1, tangent1, value2, tangent2, amount) |
Quaternion |
Interpolate between two quaternions using Hermite interpolation | |
Inverse(q) |
Quaternion |
Inverse a given quaternion | |
IsIdentity(quaternion) |
boolean |
Gets a boolean indicating if the given quaternion is identity | |
LookRotation(forward, up) |
Quaternion |
Creates a rotation with the specified forward and upwards directions. | |
multiply(q1) |
Quaternion |
Multiplies two quaternions | |
multiplyInPlace(q1) |
Quaternion |
Updates the current quaternion with the multiplication of itself with the given one "q1" | |
multiplyToRef(q1, result) |
Quaternion |
Sets the given "result" as the the multiplication result of the current one with the given one "q1" | |
normalize() |
Quaternion |
Normalize in place the current quaternion | |
RotateTowards(from, to, maxDegreesDelta) |
Quaternion |
The from quaternion is rotated towards to by an angular step of maxDegreesDelta. | |
RotationAlphaBetaGamma(alpha, beta, gamma) |
Quaternion |
Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation | |
RotationAlphaBetaGammaToRef(alpha, beta, gamma, result) |
void |
Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion | |
RotationAxis(axis, angle) |
Quaternion |
Creates a quaternion from a rotation around an axis | |
RotationAxisToRef(axis, angle, result) |
Quaternion |
Creates a rotation around an axis and stores it into the given quaternion | |
RotationQuaternionFromAxis(axis1, axis2, axis3) |
Quaternion |
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) | |
RotationQuaternionFromAxisToRef(axis1, axis2, axis3, ref) |
void |
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 | |
RotationYawPitchRoll(yaw, pitch, roll) |
Quaternion |
Creates a new quaternion from the given Euler float angles (y, x, z) | |
RotationYawPitchRollToRef(yaw, pitch, roll, result) |
void |
Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion | |
scale(value) |
Quaternion |
Multiplies the current quaternion by a scale factor | |
scaleAndAddToRef(scale, result) |
Quaternion |
Scale the current quaternion values by a factor and add the result to a given quaternion | |
scaleInPlace(value) |
Quaternion |
Multiplies in place the current quaternion by a scale factor | |
scaleToRef(scale, result) |
Quaternion |
Scale the current quaternion values by a factor and stores the result to a given quaternion | |
set(x, y, z, w) |
Quaternion |
Updates the current quaternion from the given float coordinates | |
setEuler(x, y, z) |
Quaternion |
Updates the current quaternion from the given euler angles | |
setFromToRotation(from, to, up) |
void |
Creates a rotation which rotates from fromDirection to toDirection. | |
Slerp(left, right, amount) |
Quaternion |
Interpolates between two quaternions | |
SlerpToRef(left, right, amount, result) |
void |
Interpolates between two quaternions and stores it into a target quaternion | |
subtract(other) |
Quaternion |
Subtract two quaternions | |
toEulerAnglesToRef(result, order) |
Quaternion |
Sets the given vector3 "result" with the Euler angles translated from the current quaternion | |
toRotationMatrix(result) |
Quaternion |
Updates the given rotation matrix with the current quaternion values | |
Zero() |
Quaternion |
Creates an empty quaternion |