(ImageProcessor ip, double x1, double y1, double x2, double y2, float[] data)
| 611 | } |
| 612 | |
| 613 | private float[] getLine(ImageProcessor ip, double x1, double y1, double x2, double y2, float[] data) { |
| 614 | double dx = x2-x1; |
| 615 | double dy = y2-y1; |
| 616 | int n = (int)Math.round(Math.sqrt(dx*dx + dy*dy)); |
| 617 | if (data==null) |
| 618 | data = new float[n]; |
| 619 | double xinc = dx/n; |
| 620 | double yinc = dy/n; |
| 621 | double rx = x1; |
| 622 | double ry = y1; |
| 623 | for (int i=0; i<n; i++) { |
| 624 | if (notFloat) |
| 625 | data[i] = (float)ip.getInterpolatedPixel(rx, ry); |
| 626 | else if (rgb) { |
| 627 | int rgbPixel = ((ColorProcessor)ip).getInterpolatedRGBPixel(rx, ry); |
| 628 | data[i] = Float.intBitsToFloat(rgbPixel&0xffffff); |
| 629 | } else |
| 630 | data[i] = (float)ip.getInterpolatedValue(rx, ry); |
| 631 | rx += xinc; |
| 632 | ry += yinc; |
| 633 | } |
| 634 | return data; |
| 635 | } |
| 636 | |
| 637 | private float[] getOrthoLine(ImageProcessor ip, int x1, int y1, int x2, int y2, float[] data) { |
| 638 | int w = ip.getWidth(); |
no test coverage detected