Euler

class Euler(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0, order: EulerOrder = EulerOrder.XYZ) : Iterable<Any>

A class representing Euler angles.

Euler angles describe a rotational transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order.

Iterating through an instance yields its components (x, y, z, order) in that order: three Doubles followed by an EulerOrder.

Instances are mutable and not thread-safe; confine an instance (and any object graph holding it) to a single thread, exactly as in three.js.

Reading x/y/z/order has no side effect. Writing any of them, or calling a mutating method, fires the registered onChange callback (see that method).

Constructors

Link copied to clipboard
constructor(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0, order: EulerOrder = EulerOrder.XYZ)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The order in which the axis rotations are applied. Assigning fires the onChange callback.

Link copied to clipboard
var x: Double

The angle of the x axis in radians. Assigning fires the onChange callback.

Link copied to clipboard
var y: Double

The angle of the y axis in radians. Assigning fires the onChange callback.

Link copied to clipboard
var z: Double

The angle of the z axis in radians. Assigning fires the onChange callback.

Functions

Link copied to clipboard
fun clone(): Euler

Returns a new Euler instance with copied values from this instance.

Link copied to clipboard
fun copy(euler: Euler): Euler

Copies the values of euler into this instance.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Structural equality: true when other is an Euler with equal components and order (components compared with primitive ==, so NaN != NaN).

Link copied to clipboard
fun fromArray(array: List<Any>): Euler

Sets this Euler instance's components from array. The first three entries are assigned to the x, y and z components; an optional fourth entry (an EulerOrder) defines the order.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open operator override fun iterator(): Iterator<Any>
Link copied to clipboard
fun onChange(callback: () -> Unit): Euler

Registers callback to run whenever this Euler's state changes (via a component setter or a mutating method). Reads never fire it.

Link copied to clipboard
fun reorder(newOrder: EulerOrder): Euler

Resets the euler angle with a new order by creating a quaternion from this euler angle and then setting this euler angle with the quaternion and the new order.

Link copied to clipboard
fun set(x: Double, y: Double, z: Double, order: EulerOrder = _order): Euler

Sets the Euler components.

Link copied to clipboard
fun setFromQuaternion(q: Quaternion, order: EulerOrder = _order, update: Boolean = true): Euler

Sets the angles of this Euler instance from a normalized quaternion q.

Link copied to clipboard
fun setFromRotationMatrix(m: Matrix4, order: EulerOrder = _order, update: Boolean = true): Euler

Sets the angles of this Euler instance from a pure rotation matrix m (the upper 3x3 of which must be an unscaled rotation).

Link copied to clipboard
fun setFromVector3(v: Vector3, order: EulerOrder = _order): Euler

Sets the angles of this Euler instance from the given vector v.

Link copied to clipboard
fun toArray(array: MutableList<Any> = mutableListOf(), offset: Int = 0): MutableList<Any>

Writes the components of this Euler instance into array at offset, growing the list as needed, and returns it. The order is written as the fourth element (an EulerOrder).

Link copied to clipboard
open override fun toString(): String