24 int *yTile,
int *zTile)
28 *zTile = tileIndex / map->
nxy;
29 tileIndex2d = tileIndex % map->
nxy;
30 *yTile = tileIndex2d / map->
nx;
31 *xTile = tileIndex2d % map->
nx;
51 return map->
nxy * zTile + map->
nx * yTile + xTile;
74 int zTile,
int *
x,
int *y,
int *z)
77 *y = map->
tileY * yTile;
78 *z = map->
tileZ * zTile;
100 int xTile, yTile, zTile;
130 int *yTile,
int *zTile,
int *xOffs,
int *yOffs,
135 *yTile = y / map->
tileY;
136 *yOffs = y % map->
tileY;
137 *zTile = z / map->
tileZ;
138 *zOffs = z % map->
tileZ;
159 int *tileIndex,
int *offset)
161 int xTile, yTile, zTile, xOffs, yOffs, zOffs;
166 *offset = zOffs * map->
tileXY + yOffs * map->
tileX + xOffs;
187 return (
x >= 0) && (
x < map->
region.
cols) && (y >= 0) &&
206 return (tileIndex < map->nTiles) && (tileIndex >= 0);
227 return (
x >= 0) && (
x < map->
nx) && (y >= 0) && (y < map->
ny) && (z >= 0) &&
254 int *rows,
int *cols,
int *depths,
255 int *xRedundant,
int *yRedundant,
272 *xRedundant = map->
tileX - *cols;
274 if (y != map->
clipY) {
280 *yRedundant = map->
tileY - *rows;
282 if (z != map->
clipZ) {
283 *depths = map->
tileZ;
288 *zRedundant = map->
tileZ - *depths;
295 return *depths * *cols * *rows;
318 int *tileX,
int *tileY,
int *tileZ,
321 unsigned long size = 0;
322 unsigned long x, y, z;
324 unsigned long tileSize;
325 unsigned long divx = 2;
326 unsigned long divy = 2;
327 unsigned long divz = 2;
330 size =
sizeof(
FCELL);
333 size =
sizeof(
DCELL);
340 tileSize = size *
x * y * z;
343 "Rast3d_compute_optimal_tile_dimension: tilesize %li x %li y "
347 if (maxSize < 0 || tileSize <= (
unsigned int)maxSize * 1024)
355 if ((y /
x) <= 2 && (z /
x) <= 2) {
356 if (region->
cols % divx != 0)
357 x = region->
cols / divx + 1;
359 x = region->
cols / divx;
362 if ((
x / y) <= 2 && (z / y) <= 2) {
363 if (region->
rows % divy != 0)
364 y = region->
rows / divy + 1;
366 y = region->
rows / divy;
369 if ((
x / z) <= 2 && (y / z) <= 2) {
370 if (region->
depths % divz != 0)
371 z = region->
depths / divz + 1;
373 z = region->
depths / divz;
int G_debug(int, const char *,...) __attribute__((format(printf
int Rast3d_tile_in_range(RASTER3D_Map *map, int x, int y, int z)
Returns 1 if tile-coordinate (x, y, z) is a coordinate inside tile cube. Returns 0 otherwise.
void Rast3d_tile_coord_origin(RASTER3D_Map *map, int xTile, int yTile, int zTile, int *x, int *y, int *z)
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tile-coordina...
int Rast3d_tile2tile_index(RASTER3D_Map *map, int xTile, int yTile, int zTile)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).
void Rast3d_tile_index_origin(RASTER3D_Map *map, int tileIndex, int *x, int *y, int *z)
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tileIndex.
void Rast3d_tile_index2tile(RASTER3D_Map *map, int tileIndex, int *xTile, int *yTile, int *zTile)
Converts index tileIndex into tile-coordinates (xTile, yTile, zTile).
void Rast3d_coord2tile_index(RASTER3D_Map *map, int x, int y, int z, int *tileIndex, int *offset)
Converts cell-coordinates (x, y, z) into tileIndex and the offset of the cell within the tile.
int Rast3d_tile_index_in_range(RASTER3D_Map *map, int tileIndex)
Returns 1 if tileIndex is a valid index for map. Returns 0 otherwise.
int Rast3d_compute_clipped_tile_dimensions(RASTER3D_Map *map, int tileIndex, int *rows, int *cols, int *depths, int *xRedundant, int *yRedundant, int *zRedundant)
Computes the dimensions of the tile when clipped to fit the region of map. The clipped dimensions are...
void Rast3d_compute_optimal_tile_dimension(RASTER3D_Region *region, int type, int *tileX, int *tileY, int *tileZ, int maxSize)
Compute the optimal tile size.
void Rast3d_coord2tile_coord(RASTER3D_Map *map, int x, int y, int z, int *xTile, int *yTile, int *zTile, int *xOffs, int *yOffs, int *zOffs)
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of...
int Rast3d_coord_in_range(RASTER3D_Map *map, int x, int y, int z)
Returns 1 if cell-coordinate (x, y, z) is a coordinate inside the region. Returns 0 otherwise.