I’m an iphone developer, but this question is about geometry.
I have a simple rectangle (maybe a photo). The user touches this photo at a point and drags their finger to a new point:
http://dl.dropbox.com/u/792862/Untitleddrawing.png
How many radians I must rotate this rectangle to simulate a rotation given by the touches?
I’m assuming that you have a fixed origin for your rotation (the crosshair in your picture would suggest so) and the touch sets the other point.
First you need a method to figure out the angle of a line. The atan2 function (available in any well-equipped math library) figures out the angle between any line and the X axis. First figure out the starting angle:
And then the ending angle:
And then just subtract the two angles from each other to figure out your rotation:
You might need to swap things around depending on which way your rotations work.