Re: Help with understanding matrices
Re: Help with understanding matrices
- Subject: Re: Help with understanding matrices
- From: deivy petrescu <email@hidden>
- Date: Thu, 14 Feb 2008 08:04:08 -0500
On Feb 13, 2008, at 5:46, Simon Topliss wrote:
Thanks for the replies so far. I apologise for not understanding the
complexity of the initial question.
I've found this site that describes matrices wrt Flash and I guess
the same theory applies to Illustrator.
http://www.senocular.com/flash/tutorials/transformmatrix/
So, back to my original, un-scaled and un-rotated image's values of:
{class:matrix, mvalue_a:1.0, mvalue_b:0.0, mvalue_c:0.0,
mvalue_d:-1.0, mvalue_tx:-7844.0, mvalue_ty:9305.8896484375}
If I apply a 30 anti-clockwise rotation the new martix is:
{class:matrix, mvalue_a:0.866025388241, mvalue_b:-0.5,
mvalue_c:-0.5, mvalue_d:-0.866025388241, mvalue_tx:-1.11954892578125E
+4, mvalue_ty:4044.0400390625}
If I rotate the image by 45 degrees clockwise, the matrix is now:
{class:matrix, mvalue_a:0.707106769085, mvalue_b:-0.707106769085,
mvalue_c:-0.707106769085, mvalue_d:-0.707106769085,
mvalue_tx:-1.14441533203125E+4, mvalue_ty:821.1611328125}
This is kind of weird. You rotate clockwise and anti-clockwise and get
the same result (the sign of b,c and d are negative in both cases)
And after another 30 degree rotation (60 degrees in total):
{class:matrix, mvalue_a:0.5, mvalue_b:-0.866025388241,
mvalue_c:-0.866025388241, mvalue_d:-0.5, mvalue_tx:-1.14670400390625E
+4, mvalue_ty:-2188.6005859375}
And then finally a 50% scale:
{class:matrix, mvalue_a:0.25, mvalue_b:-0.43301269412,
mvalue_c:-0.43301269412, mvalue_d:-0.25,
mvalue_tx:-5584.02001953125, mvalue_ty:-883.80078125}
I think I'm still fairly on-topic as Illustrator doesn't provide a
in-built way of providing the rotation and scale of an object with
AppleScript (or JavaScript).
I'm trying to write a AppleScript handler that will return rotation,
scale, skew of an object given its matrix.
Can anyone help me get close to achieving this?
Simon
OK Simon, I believe I know why the values of angles change. It does so
that you can find out the scaling. The angle is found by its tangent.
But, before I give you a way to find the angle and the scaling, could
you scale by an amount different than 50%?
Try 40%, 30%, 70% and 150% say.
So, the matrix is bogus, but the idea is clever.
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden