Fix bugs
Use precomputed trigonometric functions in SphereCoord

These changes are for runtime optimisation only.
Refactor codes