Geodesic in plane rotation algorithm