private boolean box9(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int minrow = Math.max(row-1, 0); int maxrow = Math.min(row+1, nrows); int col = rectIndex[1]; int mincol= Math.max(col-1, 0); int maxcol = Math.min(col+1, ncols); if (debug) System.out.printf("%n box9:"); for (int i=minrow; i<=maxrow; i++) for (int j=mincol; j<=maxcol; j++) { rectIndex[0] = i; rectIndex[1] = j; if (contains(wantLat, wantLon, rectIndex)) return true; } return false; }
private boolean box9(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int minrow = Math.max(row-1, 0); int maxrow = Math.min(row+1, nrows); int col = rectIndex[1]; int mincol= Math.max(col-1, 0); int maxcol = Math.min(col+1, ncols); if (debug) System.out.printf("%n box9:"); for (int i=minrow; i<=maxrow; i++) for (int j=mincol; j<=maxcol; j++) { rectIndex[0] = i; rectIndex[1] = j; if (contains(wantLat, wantLon, rectIndex)) return true; } return false; }
private boolean box9(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int minrow = Math.max(row-1, 0); int maxrow = Math.min(row+1, nrows); int col = rectIndex[1]; int mincol= Math.max(col-1, 0); int maxcol = Math.min(col+1, ncols); if (debug) System.out.printf("%n box9:"); for (int i=minrow; i<=maxrow; i++) for (int j=mincol; j<=maxcol; j++) { rectIndex[0] = i; rectIndex[1] = j; if (contains(wantLat, wantLon, rectIndex)) return true; } return false; }
private boolean incr(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int col = rectIndex[1]; double diffLat = wantLat - latEdge.get(row, col); double diffLon = wantLon - lonEdge.get(row, col); if (Math.abs(diffLat) > Math.abs(diffLon)) { // try lat first rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } else { rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } // back to original, do box search rectIndex[0] = row; rectIndex[1] = col; return box9(wantLat, wantLon, rectIndex); }
private boolean incr(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int col = rectIndex[1]; double diffLat = wantLat - latEdge.get(row, col); double diffLon = wantLon - lonEdge.get(row, col); if (Math.abs(diffLat) > Math.abs(diffLon)) { // try lat first rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } else { rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } // back to original, do box search rectIndex[0] = row; rectIndex[1] = col; return box9(wantLat, wantLon, rectIndex); }
private boolean incr(double wantLat, double wantLon, int[] rectIndex) { int row = rectIndex[0]; int col = rectIndex[1]; double diffLat = wantLat - latEdge.get(row, col); double diffLon = wantLon - lonEdge.get(row, col); if (Math.abs(diffLat) > Math.abs(diffLon)) { // try lat first rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } else { rectIndex[1] = col + ((diffLon > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; rectIndex[0] = row + ((diffLat > 0) ? 1 : -1); if (contains(wantLat, wantLon, rectIndex)) return true; } // back to original, do box search rectIndex[0] = row; rectIndex[1] = col; return box9(wantLat, wantLon, rectIndex); }
public boolean findCoordElementForce(double wantLat, double wantLon, int[] rectIndex) { findBounds(); if (wantLat < latMinMax.min) return false; if (wantLat > latMinMax.max) return false; if (wantLon < lonMinMax.min) return false; if (wantLon > lonMinMax.max) return false; boolean saveDebug = debug; debug = false; for (int row=0; row<nrows; row++) { for (int col=0; col<ncols; col++) { rectIndex[0] = row; rectIndex[1] = col; if (contains(wantLat, wantLon, rectIndex)) { debug = saveDebug; return true; } } } //debug = saveDebug; return false; }
public boolean findCoordElementForce(double wantLat, double wantLon, int[] rectIndex) { findBounds(); if (wantLat < latMinMax.min) return false; if (wantLat > latMinMax.max) return false; if (wantLon < lonMinMax.min) return false; if (wantLon > lonMinMax.max) return false; boolean saveDebug = debug; debug = false; for (int row=0; row<nrows; row++) { for (int col=0; col<ncols; col++) { rectIndex[0] = row; rectIndex[1] = col; if (contains(wantLat, wantLon, rectIndex)) { debug = saveDebug; return true; } } } //debug = saveDebug; return false; }
public boolean findCoordElementForce(double wantLat, double wantLon, int[] rectIndex) { findBounds(); if (wantLat < latMinMax.min) return false; if (wantLat > latMinMax.max) return false; if (wantLon < lonMinMax.min) return false; if (wantLon > lonMinMax.max) return false; boolean saveDebug = debug; debug = false; for (int row=0; row<nrows; row++) { for (int col=0; col<ncols; col++) { rectIndex[0] = row; rectIndex[1] = col; if (contains(wantLat, wantLon, rectIndex)) { debug = saveDebug; return true; } } } //debug = saveDebug; return false; }
count++; if (debug) System.out.printf("%nIteration %d %n", count); if (contains(wantLat, wantLon, rectIndex)) return true;
count++; if (debug) System.out.printf("%nIteration %d %n", count); if (contains(wantLat, wantLon, rectIndex)) return true;
count++; if (debug) System.out.printf("%nIteration %d %n", count); if (contains(wantLat, wantLon, rectIndex)) return true;