23 int *yTile,
int *zTile)
27 *zTile = tileIndex / map->
nxy;
28 tileIndex2d = tileIndex % map->
nxy;
29 *yTile = tileIndex2d / map->
nx;
30 *xTile = tileIndex2d % map->
nx;
49 return map->
nxy * zTile + map->
nx * yTile + xTile;
71 int zTile,
int *
x,
int *y,
int *z)
74 *y = map->
tileY * yTile;
75 *z = map->
tileZ * zTile;
96 int xTile, yTile, zTile;
125 int *yTile,
int *zTile,
int *xOffs,
int *yOffs,
130 *yTile = y / map->
tileY;
131 *yOffs = y % map->
tileY;
132 *zTile = z / map->
tileZ;
133 *zOffs = z % map->
tileZ;
153 int *tileIndex,
int *offset)
155 int xTile, yTile, zTile, xOffs, yOffs, zOffs;
160 *offset = zOffs * map->
tileXY + yOffs * map->
tileX + xOffs;
180 return (
x >= 0) && (
x < map->
region.
cols) && (y >= 0) &&
198 return (tileIndex < map->nTiles) && (tileIndex >= 0);
218 return (
x >= 0) && (
x < map->
nx) && (y >= 0) && (y < map->
ny) && (z >= 0) &&
244 int *rows,
int *cols,
int *depths,
245 int *xRedundant,
int *yRedundant,
262 *xRedundant = map->
tileX - *cols;
264 if (y != map->
clipY) {
270 *yRedundant = map->
tileY - *rows;
272 if (z != map->
clipZ) {
273 *depths = map->
tileZ;
278 *zRedundant = map->
tileZ - *depths;
285 return *depths * *cols * *rows;
307 int *tileX,
int *tileY,
int *tileZ,
310 unsigned long size = 0;
311 unsigned long x, y, z;
313 unsigned long tileSize;
314 unsigned long divx = 2;
315 unsigned long divy = 2;
316 unsigned long divz = 2;
319 size =
sizeof(
FCELL);
322 size =
sizeof(
DCELL);
329 tileSize = size *
x * y * z;
332 "Rast3d_compute_optimal_tile_dimension: tilesize %li x %li y "
336 if (maxSize < 0 || tileSize <= (
unsigned int)maxSize * 1024)
344 if ((y /
x) <= 2 && (z /
x) <= 2) {
345 if (region->
cols % divx != 0)
346 x = region->
cols / divx + 1;
348 x = region->
cols / divx;
351 if ((
x / y) <= 2 && (z / y) <= 2) {
352 if (region->
rows % divy != 0)
353 y = region->
rows / divy + 1;
355 y = region->
rows / divy;
358 if ((
x / z) <= 2 && (y / z) <= 2) {
359 if (region->
depths % divz != 0)
360 z = region->
depths / divz + 1;
362 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.