Cylindrical coordinates

From DmWiki

This article is a stub. You can help improve the article by expanding it.

Table of contents

Definition

Cylindrical coordinates are another way of describing a point in space. Instead of describing the point as the distance away from the origin in the horizontal (x), vertical (y) and depth (z) directions cylindrical coordinates uses the distance in the radial (r), angular (θ) and depth (z) directions.

To visualise this imagine drawing a circle centred on the origin and with the outside touching a point (see diagram). In this case the distance:

  • r is the radius of that circle or the distance from the origin to the point.
  • θ (pronounced theta) is the angle that the radius makes with the x axis.
  • z is plain old depth.

These are also frequently written as a triplet (r,θ,z).


Image:CyclindricalCoords.png

Conversion from Cartesian coordinates

It is possible to convert from Cartesian coordinates to cylindrical coordinates. Imagine the point (x,y,z) in cylindrical co-ordinates this would be written as:

  • r =  \sqrt{x^2 + y^2}
  • \tan \theta = \frac{y}{x}
  • z = z

There is a trick here because the function arctan does not cover the whole of the circle (it only ranges from 0 - half way round). To avoid this and divide by zero errors most languages come with a special tan function which delivers the correct answers. For instance, in C++ calling atan2(y, x) gives the correct result.

Conversion from spherical coordinates

To convert from spherical coordinates using the point (r,θ,φ) to cylindrical coordinates,

  • r = r
  • θ = θ
  • z = rcosφ.

Why is it useful?

when worried about circles in one plane (i.e. on one surface). For example defining a cylinder with unit one radius is easy it is all the points which are at (r=1,theta,z). If you imagine drawing a circle one would draw:

 for (float theta = 0, 2 * Pi)
       draw_cylindrical_line(1,theta,0)


DevMaster navigation