Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding coordinates of a point in a circle with angle

  1. Aug 2, 2008 #1
    I have a point (x,y), a distance (d) and an angle (a). I need a method to find a point using x,y,d and a. For example:
    I will apply this on a 3D environment, but I am not going to use the 3rd dimension so it's safe.
    This is also about programming, but I am capable of applying methods in the programming language so I asked it here.
  2. jcsd
  3. Aug 3, 2008 #2
    (x_?,y_?) = (x+d\cos\alpha,y+d\sin\alpha)
  4. Aug 3, 2008 #3
    Thanks for the answer, but I have a problem. I wrote some code to put this in action. The code starts from "0" and adds "20" to the angle until the vaule is greater than to "360". I don't know why but the code produced this:
    As you can see there are some mistakes. All are getting repeated but the ones I marked. Here is the debug output I get:
    As you can see some values are too close. I am really bad at trigonometry, so I can't find the problem.
  5. Aug 3, 2008 #4
    The center is at (-49, -1082) and your first point, with the angle, 0 is at
    (51, -1082) then radius, d, is 100.

    So, when the angle is 20 the point should be
    [tex]100(\cos(20)) + -49 \approx 45[/tex]
    [tex]100(\sin(20))+ -1082 \approx -1048[/tex]

    But you have:

    Drawing at (-8.204959, -991.151611) Angle is 20.000000

    *Could you be in radians instead of degrees?
  6. Aug 3, 2008 #5
    Ah, you are right! I was making calculations with radians.

    Thank you both so much! I was trying to figure this out for two days! Normally I post my questions to forums related to coding or just ask my friends, but can't get an answer :D
  7. Aug 3, 2008 #6
    Always a problem if you forget. When I get errors like that, the first thing I do is to check the mode on my calculator. Lol.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Finding coordinates of a point in a circle with angle