@Test public void testXyz2ell() throws Exception { double[] phi_lambda_height = Ellipsoid.xyz2ell(new Point(cr_XYZ_expected)); Assert.assertEquals(cr_GEO_expected[0], Math.toDegrees(phi_lambda_height[0]), deltaGEO); Assert.assertEquals(cr_GEO_expected[1], Math.toDegrees(phi_lambda_height[1]), deltaGEO); Assert.assertEquals(cr_GEO_expected[2], phi_lambda_height[2], deltaXYZ); }
public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2((xyz.z + e2b * b * sin3), (r - e2 * a * cos3)); final double lambda = Math.atan2(xyz.y, xyz.x); final double N = computeEllipsoidNormal(phi); final double height = (r / Math.cos(phi)) - N; return new double[]{phi, lambda, height}; }
Ellipsoid { public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2((xyz.z + e2b * b * sin3), (r - e2 * a * cos3)); final double lambda = Math.atan2(xyz.y, xyz.x); final double N = computeEllipsoidNormal(phi); final double height = (r / Math.cos(phi)) - N; return new double[]{phi, lambda, height}; } }
Ellipsoid { public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2((xyz.z + e2b * b * sin3), (r - e2 * a * cos3)); final double lambda = Math.atan2(xyz.y, xyz.x); final double N = computeEllipsoidNormal(phi); final double height = (r / Math.cos(phi)) - N; return new double[]{phi, lambda, height}; } Ellipsoid();  Ellipsoid(final double semiMajor, final double semiMinor);  Ellipsoid(Ellipsoid ell); }
Ellipsoid { public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2((xyz.z + e2b * b * sin3), (r - e2 * a * cos3)); final double lambda = Math.atan2(xyz.y, xyz.x); final double N = computeEllipsoidNormal(phi); final double height = (r / Math.cos(phi)) - N; return new double[]{phi, lambda, height}; } Ellipsoid();  Ellipsoid(final double semiMajor, final double semiMinor);  Ellipsoid(Ellipsoid ell); void showdata(); static double[] xyz2ell(final Point xyz); static Point ell2xyz(final double phi, final double lambda, final double height); static Point ell2xyz(final double[] phiLambdaHeight); static Point ell2xyz(final GeoPoint geoPoint, final double height); static Point ell2xyz(final GeoPoint geoPoint); static void ell2xyz(final GeoPoint geoPoint, double[] xyz); static void ell2xyz(final GeoPoint geoPoint, final double height, final double[] xyz); }
Ellipsoid { public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2((xyz.z + e2b * b * sin3), (r - e2 * a * cos3)); final double lambda = Math.atan2(xyz.y, xyz.x); final double N = computeEllipsoidNormal(phi); final double height = (r / Math.cos(phi)) - N; return new double[]{phi, lambda, height}; } Ellipsoid();  Ellipsoid(final double semiMajor, final double semiMinor);  Ellipsoid(Ellipsoid ell); void showdata(); static double[] xyz2ell(final Point xyz); static Point ell2xyz(final double phi, final double lambda, final double height); static Point ell2xyz(final double[] phiLambdaHeight); static Point ell2xyz(final GeoPoint geoPoint, final double height); static Point ell2xyz(final GeoPoint geoPoint); static void ell2xyz(final GeoPoint geoPoint, double[] xyz); static void ell2xyz(final GeoPoint geoPoint, final double height, final double[] xyz); static double a; static double b; static String name; }