Polar vs. Cartesian Coordinates

radar-polar-coordinatesIn this blog post we will investigate two types of coordinates used to identify the location of a point on a 2D plan:

  • Cartesian Coordinates (x,y)
  • Polar Coordinates (r,θ)

Both sets of coordinates have their own applications and are often used in computer systems and video games. After reviewing how these sets of coordinates work we will write a Python script based on trigonometric formulas to convert Cartesian coordinates into Polar coordinates and vice versa.

Cartesian CoordinatesPolar Coordinates
Cartesian coordinates are used to identify the exact location of a point on a 2D plan. Two perpendicular axis (x axis and y axis) meet at the origin (0,0). The (x,y) cartesian coordinates are based on the distance of a point from these axis.

Look at the canvas below to understand how Cartesian coordinates work:

When using Cartesian coordinates, we can divide the 2D plan into four quadrants as follows:
xy-coordinates

polar-coordinates
Polar coordinates are also used to identify the exact location of a point on a 2D plan. Using a polar coordinate system, each point on a plane is determined by a distance from a reference point and an angle from a reference direction. The reference point is called the pole, and the ray from the pole in the reference direction is the polar axis.

Look at the canvas below to understand how Polar coordinates work:


Polar to Cartesian Coordinates Conversion Formulas


Using trigonometric formulas we can easily convert Cartesian coordinates to Polar coordinates and vice-versa.
cartesian-polar-coordinates-conversion-formulas

Python Turtle Implementation


Your Task


Adapt the above Python code to generate random polar coordinates and apply the conversion to calculate and output the matching Cartesian coordinates.

Python Turtle Radar Animation


To apply the conversion formulas we have created a radar animation using Python Turtle:

Did you like this challenge?

Click on a star to rate it!

Average rating 4.4 / 5. Vote count: 13

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: