Capítulo 345 de 859

Chapter 345: Euler

Core Idea

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 will yield its components (x, y, z, order) in the corresponding order.

Key Concepts

  • isEuler : boolean (readonly): This flag can be used for type testing.
  • order : string: A string representing the order that the rotations are applied.
  • x : number: The angle of the x axis in radians.
  • y : number: The angle of the y axis in radians.
  • z : number: The angle of the z axis in radians.
  • DEFAULT_ORDER : string: The default Euler angle order.

Code Examples

const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' );
const b = new THREE.Vector3( 1, 0, 1 );
b.applyEuler(a);
  • What it demonstrates: Typical usage of Euler.

Reference Tables

Constructor

Signature
new Euler( x : number, y : number, z : number, order : string )

Properties

PropertyDescription
.isEuler : boolean (readonly)This flag can be used for type testing.
.order : stringA string representing the order that the rotations are applied.
.x : numberThe angle of the x axis in radians.
.y : numberThe angle of the y axis in radians.
.z : numberThe angle of the z axis in radians.
.DEFAULT_ORDER : stringThe default Euler angle order.

Methods

MethodDescription
.clone() : EulerReturns a new Euler instance with copied values from this instance.
.copy( euler : Euler ) : EulerCopies the values of the given Euler instance to this instance.
.equals( euler : Euler ) : booleanReturns true if this Euler instance is equal with the given one.
.fromArray( array : Array.<number, number, number, ?string> ) : EulerSets this Euler instance's components to values from the given array. The first three entries of the array are assign to the x,y and z components. An optional fourth entry defines the Euler order.
.reorder( newOrder : string ) : EulerResets 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.
.set( x : number, y : number, z : number, order : string ) : EulerSets the Euler components.
.setFromQuaternion( q : Quaternion, order : string, update : boolean ) : EulerSets the angles of this Euler instance from a normalized quaternion.
.setFromRotationMatrix( m : Matrix4, order : string, update : boolean ) : EulerSets the angles of this Euler instance from a pure rotation matrix.
.setFromVector3( v : Vector3, order : string ) : EulerSets the angles of this Euler instance from the given vector.
.toArray( array : Array.<number, number, number, string>, offset : number ) : Array.<number, number, number, string>Writes the components of this Euler instance to the given array. If no array is provided, the method returns a new instance.

Key Takeaways

  1. Most relevant properties: isEuler, order, x, y.
  2. Key methods: clone, copy, equals, fromArray.

Connects To