Results 1 to 2 of 2

Thread: Calculating Angle between two 2D Points, WITH A CATCH!

  1. #1
    Oct 2009

    Calculating Angle between two 2D Points, WITH A CATCH!

    I need some help calculating the angle between two 2d points, but theres a slight twist. I'm working with a weird way of representing rotation.

    Going clockwise, starting at WEST we have 0 degrees. At NORTH, it's -90 degrees. At EAST, it swaps from -180 degrees to 180 degrees, at SOUTH its 90 degrees, back down to 0 at WEST. Here is a picture:

    What I need to do, is write a function that takes two 2D points, and calculates the angle from point A to point B, as this wierd 0 to -180, 180 to 0, value.

    Anyone have any ideas? And no, I cannot use a standard 0-360 degrees representation, I have to solve this problem using this method of representing the angle.

    Many thanks!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member pflo's Avatar
    Apr 2009
    Albuquerque, NM
    This would be an angle measured in standard position.

    Assume the first point is at the origin. Then the difference in x values would be the x-coordinate of the second point and the difference in y-values would be its y-coordinate. Draw a quick sketch to see this. Then in the sketch you should be able to see a right triangle using the x-axis and a vertical to the second point.

    Use this triangle to calculate the angle using right-triangle trig.

    a = tan^{-1}(\frac{y_2-y_1}{x_2-x_1})

    This gives the angle in standard position.

    Note that you have taken the opposite of this twice, thus cancelling each other out. First, West is 0 degrees instead of East (as it would be in standard position). And second, North is at -90 degrees instead of South (as it would be in standard position).
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Calculating an angle of a none right angle triangle
    Posted in the Trigonometry Forum
    Replies: 14
    Last Post: Aug 19th 2011, 01:42 PM
  2. Points on a circle, calculating angle
    Posted in the Geometry Forum
    Replies: 6
    Last Post: May 7th 2010, 12:51 PM
  3. Replies: 2
    Last Post: Sep 4th 2009, 10:19 PM
  4. Replies: 4
    Last Post: Jul 14th 2008, 02:27 PM
  5. Calculating Angle From Two Points in 3d Space
    Posted in the Calculus Forum
    Replies: 2
    Last Post: Apr 9th 2008, 10:28 PM

Search Tags

/mathhelpforum @mathhelpforum