open class Quaternion(var w: Float = 1.0f, var x: Float = 0.0f, var y: Float = 0.0f, var z: Float = 0.0f)
Quaternion
(
pitch
, yaw
, roll
)
|
Constructor for creating a quaternion from pitch, yaw, and roll angles.
Signature
constructor(pitch: Float, yaw: Float, roll: Float) Parameters
pitch:
Float
yaw:
Float
roll:
Float
Returns |
Quaternion
(
w
, x
, y
, z
)
|
Signature
constructor(w: Float = 1.0f, x: Float = 0.0f, y: Float = 0.0f, z: Float = 0.0f) Parameters
w:
Float
x:
Float
y:
Float
z:
Float
Returns |
w
:
Float
[Get][Set] |
w component of the quaternion.
Signature
open var w: Float |
x
:
Float
[Get][Set] |
x component of the quaternion.
Signature
open var x: Float |
y
:
Float
[Get][Set] |
y component of the quaternion.
Signature
open var y: Float |
z
:
Float
[Get][Set] |
z component of the quaternion.
Signature
open var z: Float |
component1
()
|
Signature
operator fun component1(): Float Returns
Float
|
component2
()
|
Signature
operator fun component2(): Float Returns
Float
|
component3
()
|
Signature
operator fun component3(): Float Returns
Float
|
component4
()
|
Signature
operator fun component4(): Float Returns
Float
|
conjugate
()
|
Calculates the conjugate of the quaternion.
Signature
fun conjugate(): Quaternion |
copy
()
|
Returns a copy of this Quaternion.
Signature
fun copy(): Quaternion |
dot
(
other
)
|
Calculates the dot product of two quaternions.
Signature
fun dot(other: Quaternion): Float Parameters
other:
Quaternion Returns
Float
|
equals
(
other
)
|
Signature
open operator override fun equals(other: Any?): Boolean Parameters
other:
Any?
Returns
Boolean
|
hashCode
()
|
Signature
open override fun hashCode(): Int Returns
Int
|
inverse
()
|
Calculates the inverse of the quaternion.
Signature
fun inverse(): Quaternion |
nlerp
(
dest
, ratio
)
|
Performs normalized linear interpolation between the current quaternion and the destination quaternion.
Signature
fun nlerp(dest: Quaternion, ratio: Float): Quaternion Parameters
dest:
Quaternion
ratio:
Float
Returns
A new quaternion that is the result of interpolating between the current quaternion and the destination quaternion by the given ratio.
|
norm
()
|
Calculates the squared magnitude (length) of the quaternion.
Signature
fun norm(): Float Returns
Float
|
normalize
()
|
Normalizes the quaternion to have a magnitude of 1.
Signature
fun normalize(): Quaternion |
removePitchAndRoll
()
|
Removes the pitch and roll components from the quaternion, leaving only the yaw component.
Signature
fun removePitchAndRoll(): Quaternion |
slerp
(
dest
, ratio
)
|
Performs spherical linear interpolation between the current quaternion and the destination quaternion.
Signature
fun slerp(dest: Quaternion, ratio: Float): Quaternion Parameters
dest:
Quaternion
ratio:
Float
Returns
A new quaternion that is the result of interpolating between the current quaternion and the destination quaternion by the given ratio.
|
times
(
q
)
|
Multiplies this quaternion with another quaternion.
Signature
inline operator fun times(q: Quaternion): Quaternion Parameters
q:
Quaternion |
times
(
v
)
| |
toEuler
()
|
Converts the quaternion to Euler angles (pitch, yaw, roll).
Signature
fun toEuler(): Vector3 |
toRotationMatrix44
()
|
Converts the quaternion to a 4x4 rotation matrix.
Signature
fun toRotationMatrix44(): Matrix44 |
toString
()
|
Signature
open override fun toString(): String Returns
String
|
toVector4
()
|
Converts the quaternion to a 4D vector.
Signature
fun toVector4(): Vector4 |
unaryMinus
()
|
fromRotationMatrix
(
matrix
)
|
Creates a quaternion from a rotation matrix.
Signature
fun fromRotationMatrix(matrix: Array<FloatArray>): Quaternion Parameters
matrix:
Array
|
getRandomQuat
()
|
Formula using "Choosing a Point from the Surface of a Sphere" authored by George Marsaglia Generates uniform random quaternion.
Signature
fun getRandomQuat(): Quaternion |
lookRotation
(
forward
, lookUp
)
|
Creates a quaternion that represents a rotation from the forward vector to the look-up vector.
Signature
fun lookRotation(forward: Vector3, lookUp: Vector3 = Vector3.Up): Quaternion Parameters Returns
A quaternion representing the rotation from the forward vector to the look-up vector.
|
lookRotationAroundY
(
forward
)
|
Creates a quaternion that represents a rotation around the Y-axis from the forward vector to the look-up vector.
Signature
fun lookRotationAroundY(forward: Vector3): Quaternion Parameters
forward:
Vector3 Returns
A quaternion representing the rotation around the Y-axis from the forward vector to the look-up vector.
|