In space, as opposed to on a plane, the position of a point can be specified by three coordinates expressing its distances from three mutually perpendicular planes. The position of a point P can also specified in relation to a fixed plane with a fixed line in it and a fixed point O on the line, by its distance OP = r from the fixed point, the angle q between OP and the fixed line, and the angle f between the plane of the point and the fixed line and the fixed plane.
Conversion equations between the two sets of coordinates:
x = r.sinq.cosf, y = r.sinq.sinf, z = r.cosq,
r = √(x² + y² + z²), q = cos–1(z/√(x²+y²+z²)), f = tan–1(y/x)
The direction of a straight line may be specified by the angles it makes with the three axes of coordinates, a = cos–1(x/r), b = cos–1(y/r), g = cos–1(z/r).
The direction of a straight line can also be specified by the ratios x/r, y/r, z/r, which are the direction cosines l, m, n with the property l² + m² + n² = 1. The angle between two lines with direction cosines l, m, n and l', m', n' is: cos–1(l.l' + m.m' + n.n').