Action Script 3 2D Matrix scale and rotation extraction


AS3 2D Matrix

AS3 2D Matrix

 

 

 

 

 

 

 

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;

About Nidin Vinayak

I am a software developer and my top skills are ActionScript 3.0, Adobe Flex, Adobe AIR , JavaScript and HTML5 development. At present i am working as Lead Software Engineer @ ISPG Technologies (I) Pvt Ltd, Cochin, India

  1. No comments yet.
(will not be published)