EulerAngles Values

The EulerAngles class provides a representation for orientation in 3D space using rotation angles in degrees about each axis.

Angles can be greater than 360 and so specify multiple revolutions.

Rotations follow the right-hand-rule.

Constructors

eulerAngles <x_degrees> <y_degrees> <z_degrees>
<quat> as eulerAngles
<angleAxis> as eulerAngles
<matrix3> as eulerAngles

Extracts the rotation component as eulerAngles.

Operators

<eulerAngles> == <eulerAngles>
<eulerAngles> != <eulerAngles>
<eulerAngles> as <class>

eulerAngles can convert to Matrix3, Quat, angleAxis values.

Properties

<eulerAngles>.x: Float
<eulerAngles>.y: Float
<eulerAngles>.z: Float

Rotation about each primary axis in float degrees.

Methods

copy <eulerAngles>

Creates a new copy of the eulerAngles value.

The new value contains a copy of the input eulerAngles value and is independent of the input eulerAngles value.

FOR EXAMPLE:

newEulerAngles = copy oldEulerAngles
random <eulerAngles> <eulerAngles>

Random rotation between the eulerAngles, but uses quat Slerp, so loses multiple revolution angles.

quatToEuler <quat> order:<eulertype_integer>
eulerToQuat <eulerAngle> order:<eulertype_integer>

Convert between quat and euler angle values. The optional order parameter specifies the order of application of the angles. If not specified, XYZ ordering is used. Its value can be any of the following:

1 - XYZ
2 - XZY
3 - YZX
4 - YXZ
5 - ZXY
6 - ZYX
7 - XYX
8 - YZY
9 - ZXZ

For example:

t = teapot()
eu = eulerAngles 90 90 90
q = eulertoquat eu order:1
tr = matrix3 1
tr.rotation = q
t.rotation = tr
quatToEuler2 <quat>

Returns the same Euler value for the given Quaternion as shown in the Transform Type-In dialog.

Available in 3ds Max 2008 and higher.

Previously, available in the Avguard Extensions.

quatArrayToEulerArray <quat array>

Returns an array of smooth Euler values from the Quat array.

Available in 3ds Max 2008 and higher.

Previously, available in the Avguard Extensions.

When converting a series of quat values to eulerAngle values, it is possible for sign flips to occur in the eulerAngle values. This is due to the fact that one single quat value can be expressed through many different eulerAngle values. This flip can be detected based on the eulerAngles/quat ratio. The eulerAngles/quat ratio is the angle difference in eulerAngles space to the angle difference in quat space. If this ratio is bigger than PI the rotation between the two quat to eulerAngles conversions. This method returns the eulerAngles/quat angle ratio between the two quat to eulerAngles conversions as a float value. The actual detection of the flip is dependent on the amount of rotation in between conversions. The smaller the amount of rotation, the more accurate the detection.

Note that the following methods were broken in versions prior to 3ds Max 2012.

<float>GetEulerQuatAngleRatio <quat1> <quat2> <array1> <array2> 
<float>GetEulerQuatAngleRatio <quat1> <quat2> <eulerAngle1> <eulerAngle2> 
<float>GetEulerQuatAngleRatio <quat1> <quat2> &<var1> &<var2>  

The function returns the eulerAngles/Quat ratio as a Float.

First two arguments are quats used as inputs. The first quat is the previous rotation, the second quat is the current rotation.

The third and fourth arguments are the previous and current converted rotation angles. They will be used as outputs.

In the first signature, the resulting Euler Angle .x, .y, and .z components are stored in the array elements 1, 2, and 3.

In the second signature, the passed arguments <eulerAngle1> and <eulerAngle2> are modified to the converted values.

In the third signature, the EulerAngles passed as argument 3 and 4 are written back by-reference.

<float>GetEulerMatAngleRatio <mat1> <mat2> <array1> <array2>
<float>GetEulerMatAngleRatio <mat1> <mat1> <eulerAngle1> <eulerAngle2>  
<float>GetEulerMatAngleRatio <mat1> <mat1> &<var1> &<var2>

This method parallels the getEulerQuatAngleRatio() method, but uses matrix3 values rather than Quat values as inputs.

The first two arguments are matrix3 inputs describing the previous and current orientations.

The third and fourth arguments are the converted previous and current Euler Angles.

In the first signature, the .x, .y, and .z components are stored in the first, second, and third elements of the arrays.

In the second signature, the output Euler Angles are stored in the passed <eulerAngle1> and <eulerAngle2> by modifying them.

In the third signature, the eulerAngles are written back to the third and fourth by-reference arguments.

FOR EXAMPLE:

q1 = (quat 0.412759 0.00141638 -0.113167 0.903782)
q2 = (quat -0.150577 -0.378993 0.176638 0.895818)
a1 = #(0,0,0)
a2 = #(0,0,0)
getEulerQuatAngleRatio q1 q2 a1 a2 
-->0.583444
a1;a2
-->#(-48.5478, 5.21315, 11.922)
-->#(11.509, 47.0722, -17.2825)

a1 = #()
a2 = #()
getEulerQuatAngleRatio q1 q2 a1 a2 
-->0.583444
a1;a2
-->#(-48.5478, 5.21315, 11.922)
-->#(11.509, 47.0722, -17.2825)

a1 = eulerAngles 0 0 0 
a2 = eulerAngles 0 0 0 
getEulerQuatAngleRatio q1 q2 a1 a2 
-->0.583444
a1;a2
-->(eulerAngles -48.5478 5.21315 11.922)
-->(eulerAngles 11.509 47.0722 -17.2825)

getEulerQuatAngleRatio q1 q2 &r1 &r2 
-->0.583444
r1;r2
-->(eulerAngles -48.5478 5.21315 11.922)
-->(eulerAngles 11.509 47.0722 -17.2825)

m1 = (quat 0.412759 0.00141638 -0.113167 0.903782) as matrix3
m2 = (quat -0.150577 -0.378993 0.176638 0.895818) as matrix3
a1 = #(0,0,0)
a2 = #(0,0,0)
GetEulerMatAngleRatio m1 m2 a1 a2 
-->0.583444
a1;a2
-->#(-48.5478, 5.21315, 11.922)
-->#(11.509, 47.0722, -17.2825)

a1 = #()
a2 = #()
GetEulerMatAngleRatio m1 m2 a1 a2 
-->0.583444
a1;a2
-->#(-48.5478, 5.21315, 11.922)
-->#(11.509, 47.0722, -17.2825)

a1 = eulerAngles 0 0 0 
a2 = eulerAngles 0 0 0 
GetEulerMatAngleRatio m1 m2 a1 a2 
-->0.583444
a1;a2
-->(eulerAngles -48.5478 5.21315 11.922)
-->(eulerAngles 11.509 47.0722 -17.2825)

GetEulerMatAngleRatio m1 m2 &r3 &r4
-->0.583444
r3;r4
-->(eulerAngles -48.5478 5.21315 11.922)
-->(eulerAngles 11.509 47.0722 -17.2825)