private void clearFlowAccumulation() { for (Rectangle2DInteger rect : this.range) { int x0 = rect.getX(); int y0 = rect.getY(); int w = rect.getWidth(); int h = rect.getHeight(); int x1 = x0 + w; int y1 = y0 + h; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { flowAccumulation.set(x, y, Float.NaN); } } } }
private void initalizeNodes() { nodes.clear(); for (Rectangle2DInteger rect : this.range) { int x0 = rect.getX(); int y0 = rect.getY(); int x1 = x0 + rect.getWidth(); int y1 = y0 + rect.getHeight(); for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { float z = elev.get(x, y); if (!Float.isNaN(z)) { float[] h = elev.get3x3(x, y); for (float height : h) { if (Float.isNaN(height)) { nodes.push(new Point2DInteger(x, y)); break; } } } } } } System.out.println("Total nodes " + nodes.size()); }