|
@@ -23,9 +23,7 @@ Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];
|
|
Euler.DefaultOrder = 'XYZ';
|
|
Euler.DefaultOrder = 'XYZ';
|
|
|
|
|
|
Object.defineProperties( Euler.prototype, {
|
|
Object.defineProperties( Euler.prototype, {
|
|
-
|
|
|
|
x: {
|
|
x: {
|
|
-
|
|
|
|
get: function () {
|
|
get: function () {
|
|
|
|
|
|
return this._x;
|
|
return this._x;
|
|
@@ -37,12 +35,10 @@ Object.defineProperties( Euler.prototype, {
|
|
this._x = value;
|
|
this._x = value;
|
|
this._onChangeCallback();
|
|
this._onChangeCallback();
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
y: {
|
|
y: {
|
|
-
|
|
|
|
get: function () {
|
|
get: function () {
|
|
|
|
|
|
return this._y;
|
|
return this._y;
|
|
@@ -54,12 +50,10 @@ Object.defineProperties( Euler.prototype, {
|
|
this._y = value;
|
|
this._y = value;
|
|
this._onChangeCallback();
|
|
this._onChangeCallback();
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
z: {
|
|
z: {
|
|
-
|
|
|
|
get: function () {
|
|
get: function () {
|
|
|
|
|
|
return this._z;
|
|
return this._z;
|
|
@@ -71,12 +65,10 @@ Object.defineProperties( Euler.prototype, {
|
|
this._z = value;
|
|
this._z = value;
|
|
this._onChangeCallback();
|
|
this._onChangeCallback();
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
order: {
|
|
order: {
|
|
-
|
|
|
|
get: function () {
|
|
get: function () {
|
|
|
|
|
|
return this._order;
|
|
return this._order;
|
|
@@ -88,14 +80,11 @@ Object.defineProperties( Euler.prototype, {
|
|
this._order = value;
|
|
this._order = value;
|
|
this._onChangeCallback();
|
|
this._onChangeCallback();
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
|
|
+ },
|
|
} );
|
|
} );
|
|
|
|
|
|
Object.assign( Euler.prototype, {
|
|
Object.assign( Euler.prototype, {
|
|
-
|
|
|
|
isEuler: true,
|
|
isEuler: true,
|
|
|
|
|
|
set: function ( x, y, z, order ) {
|
|
set: function ( x, y, z, order ) {
|
|
@@ -137,9 +126,15 @@ Object.assign( Euler.prototype, {
|
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
|
|
|
|
var te = m.elements;
|
|
var te = m.elements;
|
|
- var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];
|
|
|
|
- var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];
|
|
|
|
- var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];
|
|
|
|
|
|
+ var m11 = te[ 0 ],
|
|
|
|
+ m12 = te[ 4 ],
|
|
|
|
+ m13 = te[ 8 ];
|
|
|
|
+ var m21 = te[ 1 ],
|
|
|
|
+ m22 = te[ 5 ],
|
|
|
|
+ m23 = te[ 9 ];
|
|
|
|
+ var m31 = te[ 2 ],
|
|
|
|
+ m32 = te[ 6 ],
|
|
|
|
+ m33 = te[ 10 ];
|
|
|
|
|
|
order = order || this._order;
|
|
order = order || this._order;
|
|
|
|
|
|
@@ -147,7 +142,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._y = Math.asin( clamp( m13, - 1, 1 ) );
|
|
this._y = Math.asin( clamp( m13, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m13 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m13 ) < 1 ) {
|
|
|
|
|
|
this._x = Math.atan2( - m23, m33 );
|
|
this._x = Math.atan2( - m23, m33 );
|
|
this._z = Math.atan2( - m12, m11 );
|
|
this._z = Math.atan2( - m12, m11 );
|
|
@@ -163,7 +158,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._x = Math.asin( - clamp( m23, - 1, 1 ) );
|
|
this._x = Math.asin( - clamp( m23, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m23 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m23 ) < 1 ) {
|
|
|
|
|
|
this._y = Math.atan2( m13, m33 );
|
|
this._y = Math.atan2( m13, m33 );
|
|
this._z = Math.atan2( m21, m22 );
|
|
this._z = Math.atan2( m21, m22 );
|
|
@@ -179,7 +174,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._x = Math.asin( clamp( m32, - 1, 1 ) );
|
|
this._x = Math.asin( clamp( m32, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m32 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m32 ) < 1 ) {
|
|
|
|
|
|
this._y = Math.atan2( - m31, m33 );
|
|
this._y = Math.atan2( - m31, m33 );
|
|
this._z = Math.atan2( - m12, m22 );
|
|
this._z = Math.atan2( - m12, m22 );
|
|
@@ -195,7 +190,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._y = Math.asin( - clamp( m31, - 1, 1 ) );
|
|
this._y = Math.asin( - clamp( m31, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m31 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m31 ) < 1 ) {
|
|
|
|
|
|
this._x = Math.atan2( m32, m33 );
|
|
this._x = Math.atan2( m32, m33 );
|
|
this._z = Math.atan2( m21, m11 );
|
|
this._z = Math.atan2( m21, m11 );
|
|
@@ -211,7 +206,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._z = Math.asin( clamp( m21, - 1, 1 ) );
|
|
this._z = Math.asin( clamp( m21, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m21 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m21 ) < 1 ) {
|
|
|
|
|
|
this._x = Math.atan2( - m23, m22 );
|
|
this._x = Math.atan2( - m23, m22 );
|
|
this._y = Math.atan2( - m31, m11 );
|
|
this._y = Math.atan2( - m31, m11 );
|
|
@@ -227,7 +222,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
this._z = Math.asin( - clamp( m12, - 1, 1 ) );
|
|
this._z = Math.asin( - clamp( m12, - 1, 1 ) );
|
|
|
|
|
|
- if ( Math.abs( m12 ) < 0.99999 ) {
|
|
|
|
|
|
+ if ( Math.abs( m12 ) < 1 ) {
|
|
|
|
|
|
this._x = Math.atan2( m32, m22 );
|
|
this._x = Math.atan2( m32, m22 );
|
|
this._y = Math.atan2( m13, m11 );
|
|
this._y = Math.atan2( m13, m11 );
|
|
@@ -241,7 +236,10 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- console.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order );
|
|
|
|
|
|
+ console.warn(
|
|
|
|
+ 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' +
|
|
|
|
+ order
|
|
|
|
+ );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -253,7 +251,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- setFromQuaternion: function () {
|
|
|
|
|
|
+ setFromQuaternion: ( function () {
|
|
|
|
|
|
var matrix = new Matrix4();
|
|
var matrix = new Matrix4();
|
|
|
|
|
|
@@ -265,7 +263,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- }(),
|
|
|
|
|
|
+ } )(),
|
|
|
|
|
|
setFromVector3: function ( v, order ) {
|
|
setFromVector3: function ( v, order ) {
|
|
|
|
|
|
@@ -273,7 +271,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- reorder: function () {
|
|
|
|
|
|
+ reorder: ( function () {
|
|
|
|
|
|
// WARNING: this discards revolution information -bhouston
|
|
// WARNING: this discards revolution information -bhouston
|
|
|
|
|
|
@@ -287,11 +285,16 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- }(),
|
|
|
|
|
|
+ } )(),
|
|
|
|
|
|
equals: function ( euler ) {
|
|
equals: function ( euler ) {
|
|
|
|
|
|
- return ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );
|
|
|
|
|
|
+ return (
|
|
|
|
+ euler._x === this._x &&
|
|
|
|
+ euler._y === this._y &&
|
|
|
|
+ euler._z === this._z &&
|
|
|
|
+ euler._order === this._order
|
|
|
|
+ );
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
@@ -344,9 +347,7 @@ Object.assign( Euler.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- _onChangeCallback: function () {}
|
|
|
|
-
|
|
|
|
|
|
+ _onChangeCallback: function () {},
|
|
} );
|
|
} );
|
|
|
|
|
|
-
|
|
|
|
export { Euler };
|
|
export { Euler };
|