private CarteseanCoordinate AltAzToCartesean(double[] altAz) { // The next line replaces AxesToSpherical, var result = new CarteseanCoordinate(); double radius = 90f - altAz[0]; // Avoid division 0 errors if (Math.Abs(radius) < 0.0000001) { radius = 1; } // Get the cartesian coordinates double azRadians = AstroConvert.DegToRad(altAz[1]); var x = Math.Sin(azRadians); var y = -Math.Cos(azRadians); // Get unit vector result[0] = x * radius; result[1] = y * radius; return(result); }