logo back up home forward   further reading more topics »

Maths - Cylindrical Polar coordinates

 

Cylindrical coordinates allow points to be specified using two linear distances and one angle. These three coordinates are shown on the above diagram as:

Cylinder aligned with the z axis

Cylindrical coordinates to Cartesian coordinates

 

Cx
Cy
Cz
=
r sin(θ)
r cos(θ)
h

Cartesian coordinates to Cylindrical coordinates

 

θ
r
h
=
atan2(Cx,Cy)
√(Cx2 + Cy2)
Cz

Cylinder aligned with the arbitrary axis

Cylindrical coordinates to Cartesian coordinates

We want to rotate the above so that the h axis is aligned with the arbitrary axis (Ax, Ay, Az) in other words we want to lookat the point (Ax, Ay, Az) see lookat

Cx
Cy
Cz
=
√(Az2 + Ay2) 0 Ax
0 √(Az2 + Ax2) Ay
-Ax -Ay Az
r sin(θ)
r cos(θ)
h

Multiplying gives:

Cx
Cy
Cz
=
√(Az2 + Ay2) * r sin(θ) + h*Ax
√(Az2 + Ax2) * r cos(θ) + h*Ay
-Ax * r sin(θ)-Ay * r cos(θ) + h*Az

Cartesian coordinates to Cylindrical coordinates

In order to do this we need to invert the above matrix, since this is orthogonal we can invert by transposing as follows:

r sin(θ)
r cos(θ)
h
=
√(Az2 + Ay2) 0 -Ax
0 √(Az2 + Ax2) -Ay
Ax Ay Az
Cx
Cy
Cz

Multiplying gives,

r sin(θ)
r cos(θ)
h
=
Cx * √(Az2 + Ay2) - Ax * Cz
Cy * √(Az2 + Ax2) -Ay * Cz
Cx * Ax + Cy * Ay +Cz * Az

So in terms of θ, r , h

θ
r
h
=
atan2(Cx * √(Az2 + Ay2) - Ax * Cz,Cy * √(Az2 + Ax2) -Ay * Cz)
√((Cx * √(Az2 + Ay2) - Ax * Cz)2 + (Cy * √(Az2 + Ax2) -Ay * Cz)2)
Cz

Using Tensors

This is more advanced stuff and only really needed if you need to do physics or advanced geometry in curvilinear coordinates.

On the curvilinear coordinates page we saw that the expression of coordinates as a linear equation:

ei Ai = e1 A1 + e2 A2 + e3 A3

can be modified for curvilinear coordinates where either the basis or the components depend on the location:

e(x,y,z)i Ai = e(x,y,z)1 A1 + e(x,y,z)2 A2 + e(x,y,z)3 A3

or

ei A(x,y,z)i = e1 A(x,y,z)1 + e2 A(x,y,z)2 + e3 A(x,y,z)3

where:

We have already looked at the situation where the terms are expressed as a function of a global linear coordinate system. Now lets look at the situation where the linear basis is a function of position. There are two ways to do this:

Covariant Axis

e1 A1 + e2 A2 + e3 A3 = ∂x e1 ∂θ A1 + ∂y e2 ∂r A2 + ∂z e3 ∂h A3
∂θ ∂x ∂r ∂y ∂h ∂z

where:

∂θ = ∂atan2(x,y) =y =y
∂x
∂x
1 +(x/y)2 x2+ y 2
∂r =√((x)2) + (y)2) = 1  
∂y
∂y
∂h = 1    
∂z

where:

= cosθ
-r-1sinθ    
∂x ∂r ∂θ    
= sinθ +r-1cosθ    
∂y ∂r ∂θ    
=        
∂z ∂h        

Jacobean

J =
∂x'i
∂xj
=
x
√(x2 + y2)
y
√(x2 + y2)
0
-y
(x2 + y2)
x
(x2 + y2)
0
0 0 1
=
cosθ sinθ 0
-r-1sinθ r-1cosθ 0
0 0 1

Inverse Jacobean

J-1 =
∂xj
∂x'i
=
x
√(x2 + y2)
-y 0
-y
(x2 + y2)
x 0
0 0 1
=
cosθ sinθ 0
r sinθ r cosθ 0
0 0 1

Contravariant Axis

 

e1 A1 + e2 A2 + e3 A3 = ∂θ e1 ∂x1 A1 + ∂r e2 ∂x2 A2 + ∂h e3 ∂x3 A3
∂x1 ∂θ ∂x2 ∂r ∂x3 ∂h

 


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Geometry for Computer Graphics:...

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover us uk de SuSE Linux 10.3. Operating system with a wide range of applications including Open Office. A good distribution for developers as it contains KDevelop. Java, Mono, etc. Can install itself as a dual-boot system with an existing Windows OS if required. For information about installing it see this page.

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved - privacy policy.