View Single Post
  #4  
Old 08-30-2006, 07:50 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
This is theory, may not work. Pardon my bad drawing.



1. Let's say you have you image and points set up like this (this method should work for any set-up). First, find the distance between A and B.

2. Get the slope of AB by using deltay/deltax. You can get the angle to rotate by using arctan( slope AB ) or getangle( deltax , deltay ). The slope of CD is -deltax/deltay or -1 / tan( angle ). (The dashed corner is not at A, I just suck at drawing on the computer.)

3. The green axis helps us draw an angle, theta. Theta = arctan( slope of CD ). We can then reposition the image's top point at A by:
making x = A.x - cos( theta ) * ||CD||â€*
making y = A.y

â€* Note: ||v|| is vector notation for magnitude. I'm using it as distance. ||CD|| is the image's height.

4. Finish up by stretching the image.
stretchx = ||AB|| * cos( rotationangle )
stretchy = ||AB|| * sin( rotationangle ) ‡

‡ Note: it may be -sin() because of Graal's upside-down axes, but I'm not positive...

Voila!
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote