I came up with that solution to work around the poles.
How did you calculate the intermediate non-direct point?