public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double fromY = (world.getY() - falseNorthing) / totalScale; fromY = rho0 - fromY; double rho = MapMath.distance(fromX, fromY); if (rho != 0) { if (n < 0.0) { rho = -rho; fromX = -fromX; fromY = -fromY; } if (isSpherical) toLat = 2.0 * Math.atan(Math.pow(c / rho, 1.0/n)) - MapMath.HALFPI; else toLat = MapMath.phi2(Math.pow(rho / c, 1.0/n), e); toLon = Math.atan2(fromX, fromY) / n; } else { toLon = 0.0; toLat = n > 0.0 ? MapMath.HALFPI : -MapMath.HALFPI; } result.setLatitude(Math.toDegrees(toLat)); result.setLongitude(Math.toDegrees(toLon) + lon0deg); return result; }
public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double fromY = (world.getY() - falseNorthing) / totalScale; fromY = rho0 - fromY; double rho = MapMath.distance(fromX, fromY); if (rho != 0) { if (n < 0.0) { rho = -rho; fromX = -fromX; fromY = -fromY; } if (isSpherical) toLat = 2.0 * Math.atan(Math.pow(c / rho, 1.0/n)) - MapMath.HALFPI; else toLat = MapMath.phi2(Math.pow(rho / c, 1.0/n), e); toLon = Math.atan2(fromX, fromY) / n; //coverity[swapped_arguments] } else { toLon = 0.0; toLat = n > 0.0 ? MapMath.HALFPI : -MapMath.HALFPI; } result.setLatitude(Math.toDegrees(toLat)); result.setLongitude(Math.toDegrees(toLon) + lon0deg); return result; }
public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double fromY = (world.getY() - falseNorthing) / totalScale; fromY = rho0 - fromY; double rho = MapMath.distance(fromX, fromY); if (rho != 0) { if (n < 0.0) { rho = -rho; fromX = -fromX; fromY = -fromY; } if (isSpherical) toLat = 2.0 * Math.atan(Math.pow(c / rho, 1.0/n)) - MapMath.HALFPI; else toLat = MapMath.phi2(Math.pow(rho / c, 1.0/n), e); toLon = Math.atan2(fromX, fromY) / n; //coverity[swapped_arguments] } else { toLon = 0.0; toLat = n > 0.0 ? MapMath.HALFPI : -MapMath.HALFPI; } result.setLatitude(Math.toDegrees(toLat)); result.setLongitude(Math.toDegrees(toLon) + lon0deg); return result; }
public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = (world.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double fromY = (world.getY() - falseNorthing) / totalScale; fromY = rho0 - fromY; double rho = MapMath.distance(fromX, fromY); if (rho != 0) { if (n < 0.0) { rho = -rho; fromX = -fromX; fromY = -fromY; } if (isSpherical) toLat = 2.0 * Math.atan(Math.pow(c / rho, 1.0/n)) - MapMath.HALFPI; else toLat = MapMath.phi2(Math.pow(rho / c, 1.0/n), e); toLon = Math.atan2(fromX, fromY) / n; } else { toLon = 0.0; toLat = n > 0.0 ? MapMath.HALFPI : -MapMath.HALFPI; } result.setLatitude(Math.toDegrees(toLat)); result.setLongitude(Math.toDegrees(toLon) + lon0deg); return result; }