correctly implement spherical coordinates for diverted course calculation