Java Pixel pixel_distance(int x1, int y1, int x2, int y2)

Here you can find the source of pixel_distance(int x1, int y1, int x2, int y2)

Description

Calculate the "pixel distance" between two points (squaring not involved).

License

Open Source License

Parameter

Parameter Description
x1 x coord
y1 y coord
x2 x coord
y2 y coord

Return

int pixel distance

Declaration

public final static int pixel_distance(int x1, int y1, int x2, int y2) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  w w.  java2 s . c  om
     * Calculate the "pixel distance" between two points (squaring not
     * involved).
     * <p>
     * 
     * @param x1 x coord
     * @param y1 y coord
     * @param x2 x coord
     * @param y2 y coord
     * @return int pixel distance
     */
    public final static int pixel_distance(int x1, int y1, int x2, int y2) {

        int dx = Math.abs(x1 - x2);
        int dy = Math.abs(y1 - y2);
        return (dx > dy) ? dx : dy;
    }
}

Related

  1. pixelRange(int p)
  2. pixelSize(double lat, double lng, int zoom)
  3. pixelSpacing(int n)
  4. pixelsPerPanel(int n)