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)
| 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 */ |