Quaternion

open class Quaternion

A Sceneform quaternion class for floats.

Quaternion operations are Hamiltonian using the right-hand-rule convention.

Constructors

Link copied to clipboard
constructor()
Construct Quaternion and set to Identity
constructor(x: Float, y: Float, z: Float, w: Float)
Construct Quaternion and set each value.
constructor(q: Quaternion)
Construct Quaternion using values from another Quaternion
constructor(axis: Vector3, angle: Float)
Construct Quaternion using an axis/angle to define the rotation
constructor(eulerAngles: Vector3)
Construct Quaternion based on eulerAngles.

Properties

Link copied to clipboard
open var w: Float
Link copied to clipboard
open var x: Float
Link copied to clipboard
open var y: Float
Link copied to clipboard
open var z: Float

Functions

Link copied to clipboard
open fun add(lhs: Quaternion, rhs: Quaternion): Quaternion
Adds two Quaternion's without normalizing
Link copied to clipboard
open fun axisAngle(axis: Vector3, degrees: Float): Quaternion
Get a new Quaternion using an axis/angle to define the rotation
Link copied to clipboard
open fun equals(other: Any): Boolean
Returns true if the other object is a Quaternion and the dot product is 1.0 +/- a tolerance.
open fun equals(lhs: Quaternion, rhs: Quaternion): Boolean
Compare two Quaternions Tests for equality by calculating the dot product of lhs and rhs.
Link copied to clipboard
open fun eulerAngles(eulerAngles: Vector3): Quaternion
Get a new Quaternion using eulerAngles to define the rotation.
Link copied to clipboard
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun identity(): Quaternion
Get a Quaternion set to identity
Link copied to clipboard
Link copied to clipboard
open fun inverted(): Quaternion
Get a Quaternion with the opposite rotation
Link copied to clipboard
open fun lookRotation(forwardInWorld: Vector3, desiredUpInWorld: Vector3): Quaternion
Get a new Quaternion representing a rotation towards a specified forward direction.
Link copied to clipboard
Create a Quaternion by combining two Quaternions multiply(lhs, rhs) is equivalent to performing the rhs rotation then lhs rotation Ordering is important for this operation.
Link copied to clipboard
open fun negated(): Quaternion
Flips the sign of the Quaternion, but represents the same rotation.
Link copied to clipboard
open fun normalize(): Boolean
Rescales the quaternion to the unit length.
Link copied to clipboard
Get a Quaternion with a matching rotation but scaled to unit length.
Link copied to clipboard
Rotates a Vector3 by a Quaternion
Link copied to clipboard
Get a new Quaternion representing the rotation from one vector to another.
Link copied to clipboard
open fun set(q: Quaternion)
Copy values from another Quaternion into this one
open fun set(axis: Vector3, angle: Float)
Update this Quaternion using an axis/angle to define the rotation
open fun set(qx: Float, qy: Float, qz: Float, qw: Float)
Set each value and normalize the Quaternion
Link copied to clipboard
open fun setIdentity()
Set the Quaternion to identity
Link copied to clipboard
open fun slerp(start: Quaternion, end: Quaternion, t: Float): Quaternion
Link copied to clipboard
fun Quaternion.toNewQuaternion(): Quaternion
Link copied to clipboard
open fun toString(): String