Re: Angle of touch point from center of view?
Re: Angle of touch point from center of view?
- Subject: Re: Angle of touch point from center of view?
- From: David Duncan <email@hidden>
- Date: Thu, 5 Jan 2012 11:53:43 -0800
On Jan 5, 2012, at 11:23 AM, Eric E. Dolecki wrote:
> Hmmm...
>
> I have a UITextView in the center of my app. I want to base the origin on that object.
> CGFloat rads = atan(height/width);
> From the top I get 90... around to the right side I get down to 0... then around from right to bottom -0 to -90 then around to left side 90 to 0 and then back to top from left side -0 to -90.
>
As Marco's code showed, you want to use atan2() not atan(), as atan() doesn't know which quadrant to use (you could do the work yourself, but its not worth it).
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden