Jump to content
Sign in to follow this  

Calculate direction / angle between polar coordinates

Recommended Posts

Hi folks,

I think there would be a simple geodetic solution for my question, but let's see:

I want to get the direction like on a compass between 0° and 360° between two polar coordinates.
How does this work?

for example:
r_1 = 4.47 theta_1 = 63.4
r_2 = 6.32 theta_2 = 71.6

For the result it does not matter if north or south, nor if it's 90° or 270°, only the absolute value is relevant.
Cartesian coordinates unfortunately dont work in case if points are vertically aligned (infinite slope).



Share this post

Link to post
Share on other sites

This depends on where do you need to use this calculation. Mostly you can convert them to cartesian and then use application-specific methods to avoid errors.

For example, in Excel you can use IFERROR function to default all divisions by zero (vertically aligned) to 0 or 180 degrees.

In SQL you can use NULLIF on divisors equalling zero and then COALESCE to default value.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.