directionCosines function

Utility functions for spherical coordinate and projections.