• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help with understanding matrices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with understanding matrices


  • Subject: Re: Help with understanding matrices
  • From: deivy petrescu <email@hidden>
  • Date: Tue, 19 Feb 2008 17:25:49 -0500


On Feb 19, 2008, at 14:06, Simon Topliss wrote:

Thanks for the reply, Deivy. I've got plenty to think about now. I'll start throwing some real jobs at this and see how it goes. Skewing of an image is pretty rare, so this is more of a theoretical problem for now.


Simon,
there are some constyraints. As Mark said, there are only so much you can do with the information you have. Besides, I have no idea on how to use "mvalue_ty" or "mvalue_tx". It could help.
Using the handler above and, since I knew what I needed to get :) this is the handler I came up with:


---

decode_matrix({mvalue_a:0.707106769085, mvalue_b:-0.707106769085, mvalue_c:-0.556806564331, mvalue_d:-0.857406973839, mvalue_tx:-1.012733203125E+4, mvalue_ty:2137.982421875})

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 thetax to atan (_b / _a)---x rotation
	set thetay to -1 * (atan (_c / _d))---y rotation
	set cos_thetax to cos (thetax)
	set cos_thetay to (cos (thetay))
	set hscale to _a / cos_thetax
	set vscale to _d / cos_thetay
	set thetax to 180 / pi * thetax
	set thetay to 180 / pi * thetay
	set skew to thetay - thetax
	return {thetax, thetay, hscale, vscale, skew}
end decode_matrix

--->{-45.0, -32.999998357716, 0.999999982886, -1.022340583597, 12.000001642284}

---

Noticed that I get skew not vskew or hskew. The problem is I have no way if you actually rotated 33 degrees then skewed vertically 12 or you rotated 45 degrees and skewed horizontally 12 (to the other side).
Once those 2 other variables are understood you have a better chance.


Deivy

Simon
Actually, there is a major problem with this handler.
You have to be careful. So before it blows on you, change the handler above to the one below.



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 if _a is not 0 then set thetax to atan (_b / _a) ---x rotation set cos_thetax to cos (thetax) set hscale to _a / cos_thetax set thetax to 180 / pi * thetax else set thetax to 90 * ((_b ^ 2) ^ 0.5) / _b set hscale to ((_b ^ 2) ^ 0.5) end if if _d is not 0 then set thetay to -1 * (atan (_c / _d)) ---y rotation set cos_thetay to (cos (thetay)) set vscale to _d / cos_thetay set thetay to 180 / pi * thetay else set thetay to 90 * ((_c ^ 2) ^ 0.5) / _c set vscale to ((_c ^ 2) ^ 0.5) end if set skew to thetay - thetax return {thetax, thetay, hscale, vscale, skew} end decode_matrix


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
References: 
 >Help with understanding matrices (From: Simon Topliss <email@hidden>)
 >Re: Help with understanding matrices (From: Simon Topliss <email@hidden>)
 >Re: Help with understanding matrices (From: deivy petrescu <email@hidden>)
 >Re: Help with understanding matrices (From: Simon Topliss <email@hidden>)
 >Re: Help with understanding matrices (From: "Mark J. Reed" <email@hidden>)
 >Re: Help with understanding matrices (From: Simon Topliss <email@hidden>)
 >Re: Help with understanding matrices (From: deivy petrescu <email@hidden>)
 >Re: Help with understanding matrices (From: Simon Topliss <email@hidden>)

  • Prev by Date: Quark Unicode character change
  • Next by Date: Re: Broken date math on AppleScript 2.0
  • Previous by thread: Re: Help with understanding matrices
  • Next by thread: Re: Help with understanding matrices
  • Index(es):
    • Date
    • Thread