MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / pxlToInt

Method pxlToInt

ij/src/main/java/ij/gui/Plot.java:2007–2014  ·  view source on GitHub ↗

Converts a double-precision pixel coordinate value 'v' to integer, with overflow handling: Limits are +/-Integer.MAX_VALUE/2. This ensures that the difference between two points is in the range that can be handled by ImageProcessor.moveTo. NaN values are converted to -Integer.MAX_VALUE (negative

(double v)

Source from the content-addressed store, hash-verified

2005 * NaN values are converted to -Integer.MAX_VALUE (negative).
2006 **/
2007 private int pxlToInt(double v) {
2008 if (Double.isNaN(v))
2009 return -Integer.MAX_VALUE;
2010 else if (v > -Integer.MAX_VALUE/2 && v < Integer.MAX_VALUE/2)
2011 return (int)Math.round(v);
2012 else
2013 return v > 0 ? Integer.MAX_VALUE/2 : -Integer.MAX_VALUE/2;
2014 }
2015
2016 /** Converts calibrated coordinates to pixel coordinates. In contrast to the image calibration, also
2017 * works with log axes and inverted x axes. Returns a large number instead NaN for log x axis and zero or negative x */

Callers 2

scaleXMethod · 0.95
scaleYMethod · 0.95

Calls 1

roundMethod · 0.45

Tested by

no test coverage detected