public static void normalize(Point2D.Double a) { double d = distance(a.x, a.y); a.x /= d; a.y /= d; }
public static void normalize(Point2D.Double a) { double d = distance(a.x, a.y); a.x /= d; a.y /= d; }
public static double distance(Point2D.Double a, Point2D.Double b) { return distance(a.x-b.x, a.y-b.y); }
public static double distance(Point2D.Double a, Point2D.Double b) { return distance(a.x-b.x, a.y-b.y); }
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; }
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; }
public static double distance(ProjectionPoint a, ProjectionPoint b) { return distance(a.getX()-b.getX(), a.getY()-b.getY()); }
public static double distance(ProjectionPoint a, ProjectionPoint b) { return distance(a.getX()-b.getX(), a.getY()-b.getY()); }
double rho = MapMath.distance(fromX, fromY);
public static void normalize(ProjectionPointImpl a) { double d = distance(a.getX(), a.getY()); a.setLocation( a.getX() / d, a.getY() / d); }
public static void normalize(ProjectionPointImpl a) { double d = distance(a.getX(), a.getY()); a.setLocation( a.getX() / d, a.getY() / d); }