Return to Snippet

Revision: 67701
at October 17, 2014 23:02 by TheRabbitFlash


Initial Code
rotation = Math.atan( -mat.c / mat.a);
scaleX   = Math.sqrt((mat.a * mat.a) + (mat.c * mat.c));
scaleY   = Math.sqrt((mat.b * mat.b) + (mat.d * mat.d));

sign = Math.atan(-c / a);
rad  = Math.acos(a / scaleX);
deg  = rad * degree;

if (deg > 90 && sign > 0)
{
    rotation = (360 - deg) * radian;
}
else if (deg < 90 && sign < 0)
{
    rotation = (360 - deg) * radian;
}
else
{
    rotation = rad;
}
rotationInDegree = rotation * degree;

Initial URL
http://www.infogroupindia.com/blog/posts/589/action-script-3-2d-matrix-scale-and-rotation-extraction

Initial Description
Used this snippet in various projects.

Initial Title
2D Matrix scale and rotation extraction

Initial Tags


Initial Language
ActionScript 3