30 *zTile = tileIndex / map->
nxy;
31 tileIndex2d = tileIndex % map->
nxy;
32 *yTile = tileIndex2d / map->
nx;
33 *xTile = tileIndex2d % map->
nx;
54 return map->
nxy * zTile + map->
nx * yTile + xTile;
81 *x = map->
tileX * xTile;
82 *y = map->
tileY * yTile;
83 *z = map->
tileZ * zTile;
105 int xTile, yTile, zTile;
137 int *yTile,
int *zTile,
int *xOffs,
int *yOffs,
140 *xTile = x / map->
tileX;
141 *xOffs = x % map->
tileX;
142 *yTile = y / map->
tileY;
143 *yOffs = y % map->
tileY;
144 *zTile = z / map->
tileZ;
145 *zOffs = z % map->
tileZ;
170 int xTile, yTile, zTile, xOffs, yOffs, zOffs;
173 &xTile, &yTile, &zTile, &xOffs, &yOffs, &zOffs);
175 *offset = zOffs * map->
tileXY + yOffs * map->
tileX + xOffs;
197 return (x >= 0) && (x < map->
region.
cols) && (y >= 0) &&
217 return (tileIndex < map->nTiles) && (tileIndex >= 0);
239 return (x >= 0) && (x < map->
nx) && (y >= 0) && (y < map->
ny) &&
240 (z >= 0) && (z < map->
nz);
268 int *cols,
int *depths,
int *xRedundant,
269 int *yRedundant,
int *zRedundant)
279 if (x != map->
clipX) {
285 *xRedundant = map->
tileX - *cols;
287 if (y != map->
clipY) {
293 *yRedundant = map->
tileY - *rows;
295 if (z != map->
clipZ) {
296 *depths = map->
tileZ;
301 *zRedundant = map->
tileZ - *depths;
308 return *depths * *cols * *rows;
334 unsigned long size = 0;
335 unsigned long x, y, z;
337 unsigned long tileSize;
338 unsigned long divx = 2;
339 unsigned long divy = 2;
340 unsigned long divz = 2;
343 size =
sizeof(
FCELL);
346 size =
sizeof(
DCELL);
353 tileSize = size * x * y * z;
355 G_debug(2,
"Rast3d_compute_optimal_tile_dimension: tilesize %li x %li y %li z %li\n", tileSize, x, y, z);
357 if(tileSize <= maxSize * 1024)
365 if((y / x) <= 2 && (z / x) <= 2) {
366 if(region->
cols % divx != 0)
367 x = region->
cols / divx + 1;
369 x = region->
cols / divx;
372 if((x / y) <= 2 && (z / y) <= 2) {
373 if(region->
rows % divy != 0)
374 y = region->
rows / divy + 1;
376 y = region->
rows / divy;
379 if((x / z) <= 2 && (y / z) <= 2) {
380 if(region->
depths % divz != 0)
381 z = region->
depths / divz + 1;
383 z = region->
depths / divz;
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_tile2tile_index(RASTER3D_Map *map, int xTile, int yTile, int zTile)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).
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...
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...
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...
void Rast3d_tile_index2tile(RASTER3D_Map *map, int tileIndex, int *xTile, int *yTile, int *zTile)
Converts index tileIndex into tile-coordinates (xTile, yTile, zTile).
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_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_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_tile_index_in_range(RASTER3D_Map *map, int tileIndex)
Returns 1 if tileIndex is a valid index for map. Returns 0 otherwise.
int G_debug(int, const char *,...) __attribute__((format(printf