Java Utililty Methods Pixel

List of utility methods to do Pixel

Description

The list of methods to do Pixel are organized into topic(s).

Method

intpixel_distance(int x1, int y1, int x2, int y2)
Calculate the "pixel distance" between two points (squaring not involved).
int dx = Math.abs(x1 - x2);
int dy = Math.abs(y1 - y2);
return (dx > dy) ? dx : dy;
intpixelRange(int p)
Utility method to limit the value within [0,255] range
return ((p > 255) ? 255 : (p < 0) ? 0 : p);
doublepixelSize(double lat, double lng, int zoom)
pixel Size
double scale = (1 << zoom) * TILE_SIZE;
return 40075160 * Math.cos(Math.PI * lat / 180) / scale;
doublepixelSpacing(int n)
pixel Spacing
double k = 1.;
return 1. / (n - 1 + k * SQRT_3);
intpixelsPerPanel(int n)
pixels Per Panel
return n * (n + 1) / 2;
booleanpixelValuesEqual(final double num1, final double num2)
Compares two double values with the error margin of #PIXEL_EPSILON (i.e.
return Math.abs(num1 - num2) <= PIXEL_EPSILON;