Touch rotation

So I attempted to make a simple app that displays a gear. If the user touches the gear they can rotate it. Right now I have the app calculate the angle made by the user’s finger in relation to the middle of the gear (the center of the screen). I do this by defining the point that the user first touches the gear as one point, then any point they move their finger to as another, forming a triangle. Because I know the lengths of all the sides (distance between the points), I know all the angles and so, the number of degrees the graphic must rotate to correspond to the user’s touch.
After testing, I can see there are two problems with this. The first is that it ends up not corresponding at all and rotating in strange ways. The second is that it will only rotate clockwise.
Is there a simpler way to do this? Or what could I be doing wrong? [import]uid: 30592 topic_id: 6110 reply_id: 306110[/import]

Not sure, but maybe this post will help you. It helped me.

http://developer.anscamobile.com/forum/2011/01/22/dial-not-behaving#comment-19486 [import]uid: 11144 topic_id: 6110 reply_id: 21493[/import]

Not sure if this might be close to what you need but you can also take a look at this to get an idea of the method to calculate then trasform a graphic:
http://developer.anscamobile.com/code/joystick

Matthew Pringle did an awesome job with this sample:
[import]uid: 8045 topic_id: 6110 reply_id: 21502[/import]

Thank you for the info. I will try implementing the joint feature into the program to see how it does. As for the original program, I think it is either an issue with the coordinate system that the iphone uses or I am using the wrong methods of calculating the angle. I’ll experiment with that too. Thanks! [import]uid: 30592 topic_id: 6110 reply_id: 21854[/import]