public class TilingScheme
extends java.lang.Object
TilePosition
and Tile
classes to aid in the manipulation of tile coordinates and data. A
general tiling in 2D looks as follows:
tile column dimension tile position coordinates <---------> / / ^ +---------*-------/-*---+ ^ | | * / * | | tile row | | * v * | | dimension | | [0,0] * [0,1] * [0,2] | | | * * | | | | * * | | v ************************* | | * * | | global row dimension | * * | | | [1,0] * [1,1] * [1,2] | | * * | | | * * | | ************************* | | * * | | truncated -->| [2,0] * [2,1] * [2,2] | tile +---------*---------*---+ v <-----------------------> global column dimensionIn the example above, the tile count in both dimensions is 3, even though some tiles are truncated due to the tile dimensions.
Modifier and Type | Class and Description |
---|---|
class |
TilingScheme.Tile
A tile is a rectangular section of data with associated
attributes.
|
class |
TilingScheme.TilePosition
A tile position stores the row and column location coordinates of
a tile in a tiling scheme.
|
Modifier and Type | Field and Description |
---|---|
static int |
COLS
Index of columns dimension.
|
static int |
ROWS
Index of rows dimension.
|
Constructor and Description |
---|
TilingScheme(int[] dims,
int[] tileDims)
Creates a new tiling scheme from the specified dimensions.
|
Modifier and Type | Method and Description |
---|---|
TilingScheme.TilePosition |
createTilePosition(int row,
int col)
Creates a new tile position from global coordinates.
|
int[] |
getDimensions()
Gets the global dimensions as [rows, columns].
|
int[] |
getTileCounts()
Gets the tile counts as [rows, columns].
|
int[] |
getTileDimensions()
Gets the tile dimensions as [rows, columns].
|
int[] |
getTileDimensions(TilingScheme.TilePosition pos)
Deprecated.
As of 3.3.1, use
TilingScheme.TilePosition.getDimensions() . |
static void |
main(java.lang.String[] argv)
Tests this class.
|
public static final int ROWS
public static final int COLS
public TilingScheme(int[] dims, int[] tileDims)
dims
- the global dimensions as [rows, columns].tileDims
- the tile dimensions as [rows, columns].public int[] getDimensions()
public int[] getTileDimensions()
@Deprecated public int[] getTileDimensions(TilingScheme.TilePosition pos)
TilingScheme.TilePosition.getDimensions()
.getTileDimensions()
for tiles at the truncated
positions.pos
- the tile position.public int[] getTileCounts()
public TilingScheme.TilePosition createTilePosition(int row, int col)
row
- the data row coordinate.col
- the data column coordinate.java.lang.IndexOutOfBoundsException
- if the coordinates do not reference
a valid tile in the tiling scheme.public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- the array of command line parameters.java.lang.Exception