• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getting NSPoints from a circle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting NSPoints from a circle


  • Subject: Re: getting NSPoints from a circle
  • From: Henry McGilton <email@hidden>
  • Date: Fri, 4 Feb 2005 18:32:31 -0800


On Feb 4, 2005, at 5:19 PM, Peter Browne wrote:

I'm sorry if this has been covered here before, but I'm wondering if anyone can help me. I'm trying to make an abstract clock (just to see if I can really), and i want to draw blobs to represent seconds minutes hours etc at corresponding points around a circle, so as time moves forward, the position of these blobs rotates around the circumference of said circle (hope that explains the idea clearly enough..). Is there any easy way to find out the location of points along the circle (which is itself a bezierPathWithOvalInRect: type affair) so that I can tell these blobs where to draw themselves? Any help would be greatly appreciated.

Well, given that it is a circle, surely elementary trigonometry will give you the points you want:

For a circle of radius  r, with centre at  (cx, cy), the
(x, y) position a given point on the circumference at angle
theta is:

    x = cx + r cos(theta)
    y = cy + r sin(theta)

    Cheers,
		........  Henry


===============================+============================ Henry McGilton, Boulevardier | Trilithon Software Objective-C/Java Composer | Seroia Research -------------------------------+---------------------------- mailto:email@hidden | http://www.trilithon.com | ===============================+============================

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >getting NSPoints from a circle (From: Peter Browne <email@hidden>)

  • Prev by Date: Re: getting NSPoints from a circle
  • Next by Date: newbie dictionary/unicode problem
  • Previous by thread: Re: getting NSPoints from a circle
  • Next by thread: newbie dictionary/unicode problem
  • Index(es):
    • Date
    • Thread