Skip to content

Commit bd90852

Browse files
author
gonchar
committed
1 parent af75ce6 commit bd90852

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/away3d/core/math/Matrix3DUtils.as

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ package away3d.core.math {
181181
return target;
182182
}
183183

184-
185-
186184
public static function decompose(sourceMatrix:Matrix3D, orientationStyle:String = "eulerAngles"):Vector.<Vector3D> {
187185
var raw:Vector.<Number> = RAW_DATA_CONTAINER;
188186
sourceMatrix.copyRawDataTo(raw);
@@ -210,6 +208,10 @@ package away3d.core.math {
210208
var scaleY:Number = ty;
211209
var scaleZ:Number = tz;
212210

211+
if (a*(f*k - j*g) - e*(b*k - j*c) + i*(b*g - f*c) < 0) {
212+
scaleZ = -scaleZ;
213+
}
214+
213215
a = a / scaleX;
214216
e = e / scaleX;
215217
i = i / scaleX;
@@ -224,7 +226,9 @@ package away3d.core.math {
224226
if (orientationStyle == Orientation3D.EULER_ANGLES) {
225227
tx = Math.atan2(j, k);
226228
ty = Math.atan2(-i, Math.sqrt(a * a + e * e));
227-
tz = Math.atan2(e, a);
229+
var s1:Number = Math.sin(tx);
230+
var c1:Number = Math.cos(tx);
231+
tz = Math.atan2(s1*c-c1*b, c1*f - s1*g);
228232
} else if (orientationStyle == Orientation3D.AXIS_ANGLE) {
229233
tw = Math.acos((a + f + k - 1) / 2);
230234
var len:Number = Math.sqrt((j - g) * (j - g) + (c - i) * (c - i) + (e - b) * (e - b));

0 commit comments

Comments
 (0)