Here you can find the source of pixel_distance(int x1, int y1, int x2, int y2)
Parameter | Description |
---|---|
x1 | x coord |
y1 | y coord |
x2 | x coord |
y2 | y coord |
public final static int pixel_distance(int x1, int y1, int x2, int y2)
//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; } }