Name | Summary |
---|---|
Quaternion | constructor(pitch: Float, yaw: Float, roll: Float) Constructor for creating a quaternion from pitch, yaw, and roll angles. constructor(w: Float = 1.0f, x: Float = 0.0f, y: Float = 0.0f, z: Float = 0.0f) |
Name | Summary |
---|---|
Companion | object Companion |
Name | Summary |
---|---|
w | var w: Float |
x | var x: Float |
y | var y: Float |
z | var z: Float |
Name | Summary |
---|---|
conjugate | fun conjugate(): Quaternion Calculates the conjugate of the quaternion. |
dot | fun dot(other: Quaternion): Float Calculates the dot product of two quaternions. |
inverse | fun inverse(): Quaternion Calculates the inverse of the quaternion. |
nlerp | fun nlerp(dest: Quaternion, ratio: Float): Quaternion Performs normalized linear interpolation between the current quaternion and the destination quaternion. |
norm | fun norm(): Float Calculates the squared magnitude (length) of the quaternion. |
normalize | fun normalize(): Quaternion Normalizes the quaternion to have a magnitude of 1. |
removePitchAndRoll | fun removePitchAndRoll(): Quaternion Removes the pitch and roll components from the quaternion, leaving only the yaw component. |
slerp | fun slerp(dest: Quaternion, ratio: Float): Quaternion Performs spherical linear interpolation between the current quaternion and the destination quaternion. |
times | |
toEuler | fun toEuler(): Vector3 Converts the quaternion to Euler angles (pitch, yaw, roll). |
toRotationMatrix44 | fun toRotationMatrix44(): Matrix44 Converts the quaternion to a 4x4 rotation matrix. |
toString | open override fun toString(): String |
toVector4 | fun toVector4(): Vector4 Converts the quaternion to a 4D vector. |
unaryMinus | operator fun unaryMinus(): Quaternion Negates the quaternion. |
Name | Summary |
---|---|
rnd_ | val rnd_: Random |
Name | Summary |
---|---|
fromRotationMatrix | fun fromRotationMatrix(matrix: Array<FloatArray>): Quaternion Creates a quaternion from a rotation matrix. |
getRandomQuat | fun getRandomQuat(): Quaternion Formula using "Choosing a Point from the Surface of a Sphere" authored by George Marsaglia Generates uniform random quaternion. Code modified from https://stackoverflow.com/questions/31600717/how-to-generate-a-random-quaternion-quickly |
lookRotation | |
lookRotationAroundY | fun lookRotationAroundY(forward: Vector3): Quaternion Creates a quaternion that represents a rotation around the Y-axis from the forward vector to the look-up vector. |