Angles in 3D

Direction in 2D is equivalent to finding a point on a circle

Direction in 3D is equivalent to finding a point on a sphere
  where heading = longitude, pitch = latitude

    x = cos(longitude) * cos(latitude)
    y = sin(latitude)
    z = -sin(longitude) * cos(latitude)