Re: Help with understanding matrices
Re: Help with understanding matrices
- Subject: Re: Help with understanding matrices
- From: Simon Topliss <email@hidden>
- Date: Wed, 13 Feb 2008 16:24:24 +0000
Mark,
On 13 Feb 2008, at 15:58, Mark J. Reed wrote:
On Feb 13, 2008 5:46 AM, Simon Topliss <email@hidden> wrote:
{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'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?
Yes... I gave you the formula in my last message. Try this:
on decode_matrix(mat)
set a to mvalue_a of mat
set b to mvalue_b of mat
set c to mvalue_c of mat
set d to mvalue_d of mat
set theta to atan2(c, d);
set cos_theta to cos(theta);
set hscale to a / cos_theta
set vscale to d / cos_theta
set theta_deg to theta / pi * 180
return {theta_deg, hscale, vscale}
end decode_matrix
Thank you, thank you, thank you!
So simple when you know how!
Brilliant.
Simon
_______________________________________________
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