Coordinate Systems
Give me a firm place to stand and i will give your rounding errors far away
Give me a firm place to stand and i will give your rounding errors far away
Ways to describe the position of a point space.
Cartesian
A point is expressed as P = xi + yi + zi, where i, j and k are unit vectors parallel to the axes of the coordinate system.
To Cylindrical
r = sqrt(x2+y2)
θ = arctan y/x
z = z
To Spherical
r = sqrt(x+y+z)
θ = arctan y/x
φ = arctan( sqrt(x+y+z) / z )
Cylindrical
A point is made up of r, θ and z. θ is the angle around the z-axis. r is the distance to the point from the z-axis and z is the height of the point above the x-y plane.
To Cartesian
x = r cos θ
y = r sin θ
z = z
To Spherical
r = sqrt(r2+z2)
θ = θ
φ = arctan r/z
Spherical
A point is made up of r, θ and φ. r is the distance from the origin to the point. θ is the angle around the z-axis and φ is the angle between the z-axis and line to the point from the origin.
To Cartesian
x = r cos θ sin φ
y = r sin θ sin φ
z = r cos φ
To Cylindrical
θ = θ
r = r sin φ
z = r cos φ
Reference3D Math Primer for Game Programmers (Coordinate Systems) - 2011