@Override public Vec3 geographicToCartesian(Globe globe, double latitude, double longitude, double altitude, Vec3 result) { if (globe == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ProjectionWgs84", "geographicToCartesian", "missingGlobe")); } if (result == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ProjectionWgs84", "geographicToCartesian", "missingResult")); } double radLat = Math.toRadians(latitude); double radLon = Math.toRadians(longitude); double cosLat = Math.cos(radLat); double sinLat = Math.sin(radLat); double cosLon = Math.cos(radLon); double sinLon = Math.sin(radLon); double ec2 = globe.getEccentricitySquared(); double rpm = globe.getEquatorialRadius() / Math.sqrt(1.0 - ec2 * sinLat * sinLat); result.x = (altitude + rpm) * cosLat * sinLon; result.y = (altitude + rpm * (1.0 - ec2)) * sinLat; result.z = (altitude + rpm) * cosLat * cosLon; return result; }
public double radiusOfPrimeVeritcal(double geographicLat) { double a = globe.getEquatorialRadius(); double e2 = globe.getEccentricitySquared(); double sinSquared = Math.pow(Math.sin(Math.toRadians(geographicLat)), 2); return a / Math.sqrt(1 - e2 * sinSquared); }
@Override public Vec3 geographicToCartesianNormal(Globe globe, double latitude, double longitude, Vec3 result) { if (globe == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ProjectionWgs84", "geographicToCartesianNormal", "missingGlobe")); } if (result == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ProjectionWgs84", "geographicToCartesianNormal", "missingResult")); } double radLat = Math.toRadians(latitude); double radLon = Math.toRadians(longitude); double cosLat = Math.cos(radLat); double sinLat = Math.sin(radLat); double cosLon = Math.cos(radLon); double sinLon = Math.sin(radLon); double eqr2 = globe.getEquatorialRadius() * globe.getEquatorialRadius(); double pol2 = globe.getPolarRadius() * globe.getPolarRadius(); result.x = cosLat * sinLon / eqr2; result.y = (1 - globe.getEccentricitySquared()) * sinLat / pol2; result.z = cosLat * cosLon / eqr2; return result.normalize(); }
double e2 = globe.getEccentricitySquared(); double e4 = e2 * e2;
double sinLon = Math.sin(radLon); double ec2 = globe.getEccentricitySquared(); double rpm = globe.getEquatorialRadius() / Math.sqrt(1.0 - ec2 * sinLat * sinLat); double eqr2 = globe.getEquatorialRadius() * globe.getEquatorialRadius(); double uy = (1 - globe.getEccentricitySquared()) * sinLat / pol2; double uz = cosLat * cosLon / eqr2; double len = Math.sqrt(ux * ux + uy * uy + uz * uz);
double uy = (1 - globe.getEccentricitySquared()) * sinLat / pol2; double uz = cosLat * cosLon / eqr2; double len = Math.sqrt(ux * ux + uy * uy + uz * uz);
double ec2 = globe.getEccentricitySquared(); double cosLat, sinLat, rpm; double[] cosLon = new double[numLon];
double ec2 = globe.getEccentricitySquared();
double e2 = globe.getEccentricitySquared(); double sinLat = Math.sin(Math.toRadians(lat)); double Rn = a / Math.sqrt(1 - e2 * sinLat * sinLat);