Skip to content

Commit

Permalink
simplified mathematics of 'DisplayObject.transformationMatrix' setter
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimaryFeather committed Jan 16, 2014
1 parent e371135 commit b04eeae
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions starling/src/starling/display/DisplayObject.as
Original file line number Diff line number Diff line change
Expand Up @@ -517,23 +517,12 @@ package starling.display

mX = matrix.tx;
mY = matrix.ty;
mScaleX = Math.sqrt(matrix.a * matrix.a + matrix.b * matrix.b);
mSkewY = Math.acos(matrix.a / mScaleX);

if (!isEquivalent(matrix.b, mScaleX * Math.sin(mSkewY)))
{
mScaleX *= -1;
mSkewY = Math.acos(matrix.a / mScaleX);
}

mScaleY = Math.sqrt(matrix.c * matrix.c + matrix.d * matrix.d);
mSkewX = Math.acos(matrix.d / mScaleY);
mSkewX = Math.atan(-matrix.c / matrix.d);
mSkewY = Math.atan( matrix.b / matrix.a);

if (!isEquivalent(matrix.c, -mScaleY * Math.sin(mSkewX)))
{
mScaleY *= -1;
mSkewX = Math.acos(matrix.d / mScaleY);
}
mScaleX = matrix.a / Math.cos(mSkewY);
mScaleY = matrix.d / Math.cos(mSkewX);

if (isEquivalent(mSkewX, mSkewY))
{
Expand Down

0 comments on commit b04eeae

Please sign in to comment.