Return to site

Spherical Co-Ordinates

The world of round things

October 8, 2021

Earlier in this series we introduced the concept of the cartesian system, which allows you to define the location of an object in three dimensions. This system is very linear and easy to understand. But there are other co-ordinate systems that exist that help us to make sense of the world around us. In this post I'm going to talk about the spherical co ordinate system.

If the cartesian system is like encasing the world in a giant cube, the spherical co ordinate system is like encasing it in a giant sphere. The three components that define the location of an object in the polar system is r which is equivalent to the radius of a circle or sphere, theta which is the lateral angle and phi which is the azimuthal angle.

Let's do a thought exercise. In the cartesian system, if you increase any of your component values in x, y and z, your object will move in a straight line in the positive direction of whatever axis you're moving it along.

In the spherical system, things are a little different. If you increase r, given that it is a radius, then your point moves further and further away from the origin. If you increase theta, your object won't move in a straight line but it will curve. Because theta is an angle, once you hit 360 degrees you'll end up right back where you started. If you increase phi, the same thing happens but adjacent to the ground instead of flat against it.

Why would you want to define space this way? Because there are some things that are easier to define in spherical co ordinates i.e. round things. What round things? Circles, spirals etc. For example, if you wanted to make a flat spiral, you could increase r and theta of a point at the same rate. If you wanted to do that in 3D, start with some value of r, like -5 and iterate from -5 to 5 whilst also increasing theta and phi from zero.

Doing similar things in the cartesian system is a bit harder to do. There are some tricks you can use, like using trig functions or iterating through geometric equations. If you want to create something in spherical co ordinates but want the equivalent location in cartesian here are a helpful set of equations that transform between the two systems.

To Spherical:    r = sqrt(square sum of x, y,z)    theta = arccos(z)    phi = arctan(y/x)

To Cartesian:    x = rcos(phi)sin(theta)    y = rsin(phi)sin(theta)    z = rcos(theta)

Other things you can do in polar co ordinates are making a variety of curves; rose, maurer, golden curves or even fractals. The mandelbulb is a spherical transformation of the mandelbrot set. You might also be interested to know that the spherical co ordinate system has uses in astronomy and in geography where it is used to describe locations on Earth. This planet is, of course, roughly spherical(sorry flat-earthers). As always, please leave me your feedback and questions at steambeanblog@gmail.com.

Take care and stay curious,

-Kit