int quad = findQuadrant(x,y); int split = (size + 1) >> 1; for (int i = children.size(); --i >= 0; ) { Spatial spat = (Spatial)children.get(i); int col = x; int row = y; boolean match = false; if (quadrant == 1 && (quad & 1) != 0) { match = true; } else if (quadrant == 2 && (quad & 2) != 0) { row = y-split+1; match = true; } else if (quadrant == 3 && (quad & 4) != 0) { col = x-split+1; match = true; } else if (quadrant == 4 && (quad & 8) != 0) { col = x-split+1; row = y-split+1; match = true; }
int quad = findQuadrant(x,y); int split = (size + 1) >> 1; for (int i = children.size(); --i >= 0; ) { Spatial spat = (Spatial)children.get(i); int col = x; int row = y; boolean match = false;
    public void setHeightMapValue(int x, int y, int newVal) {        int quad = findQuadrant(x,y);        int split = (size + 1) >> 1;        for (int i = children.size(); --i >= 0; ) {            Spatial spat = (Spatial)children.get(i);            int col = x;            int row = y;            boolean match = false;            if (quadrant == 1 && (quad & 1) != 0) {                 match = true;            }            else if (quadrant == 2 && (quad & 2) != 0) {                 row = y-split+1;                match = true;            }            else if (quadrant == 3 && (quad & 4) != 0) {                 col = x-split+1;                match = true;            }            else if (quadrant == 4 && (quad & 8) != 0) {                 col = x-split+1;                row = y-split+1;                match = true;            }            if (match) {                if ((spat.getType() & Spatial.TERRAIN_PAGE) != 0) {                    ((TerrainPage)spat).setHeightMapValue(col, row, newVal);                } else if ((spat.getType() & Spatial.TERRAIN_BLOCK) != 0) {                    ((TerrainBlock)spat).setHeightMapValue(col, row, newVal);                }            }        }    }