> >> Adrian Park wrote: > >> if you could enclose the rotated clip in a wrapper > >> clip [...] you will have the width of imaginery > >> bounding box. > > True, but in this scenario I'm writing a class that needs to > determine this with the user's MCs as they are. Definitely the way I'd go, > though, if the MCs were under my control. :) > > > Danny Kodicek wrote: > > assuming your original clip is rectangular; or that > > you;re looking for the dimensions of *its* bounding > > box when rotated, > > Bingo! > > > then at an angle of A, the new width will be > > Math.abs(w*cos(A))+Math.abs(h*sin(A)), the new height will be > > Math.abs(w*sin(A))+Math.abs(h*cos(A)). > > Remember that if A is measured in degrees, you need > > to multiply it by pi/180 to convert to radians. > > In my implementation, that gets *close*, but not quite there. My MC > is a 150x30 rectangle rotated to 45 degrees. My results show width and > height both at 180, when they should be closer to 130. Here's my code: > > var a:Number = mc._rotation * Math.PI / 180; > // > var w:Number = Math.abs(mc._width * Math.cos(a)) + Math.abs(mc._height * > Math.sin(a)); > var h:Number = Math.abs(mc._width * Math.sin(a)) + Math.abs(mc._height * > Math.cos(a));
That's odd: when I go through those calculations with a calculator, they come out with about 130, just as you say (it's a simple calculation, since cos(a) and sin(a) are both the same value, 1/sqrt(2), so the total is just 180/sqrt(2)). Are you sure your mc._width and mc._height are returning the correct values? Best Danny _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

