This is exactly what I was going for. Thanks Toon!
On 9/26/05, Toon Van Acker <toon dot van dot acker at mac dot com> wrote:
> You can use this bit of code to calculate the full rectangular (or
> whatever I'm supposed to call it) size of the picture, and the x and
> y coordinate of where the Object2D should be so the edges aren't
> clipped off.
>
> dim w, h, newX, newY, newW, newH, rotation, cosR, sinR as double
>
> w = imageWidth / 2.0
> h = imageHeight / 2.0
>
> cosR = cos(rotation)
> sinR = sin(rotation)
>
> newX = max( abs(cosR * w - sinR * h), abs(cosR * w + sinR * h) )
> newY = max( abs(sinR * w + cosR * h), abs(sinR * w - cosR * h) )
>
> newW = newX * 2.0
> newH = newY * 2.0
>
> Rotation is in radians and imageWidth and imageHeight are well... the
> width and height of the image.
> (This is taken out from the middle of other code. It should work, but
> if it doesn't, tell me. Also, you might have to handle rounding from
> double to integer to make sure a pixel isn't accidently clipped off,
> but I never really needed that myself so it isn't in here. A ceil
> (newX) and ceil(newY) would probably be easiest.)
>
>
> ---
> Toon Van Acker <toon dot van dot acker at mac dot com>
> <http://homepage.mac.com/barthold.van.acker/realbasic/>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
>
--
Andrew Krebs
andykr at gmail dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|