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) &&
198 (y < map->region.rows) && (z >= 0) && (z < map->region.depths);
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)
275 if ((x != map->clipX) && (y != map->clipY) && (z != map->clipZ)) {
276 return map->tileSize;
279 if (x != map->clipX) {
284 *cols = (map->region.cols - 1) % map->tileX + 1;
285 *xRedundant = map->tileX - *cols;
287 if (y != map->clipY) {
292 *rows = (map->region.rows - 1) % map->tileY + 1;
293 *yRedundant = map->tileY - *rows;
295 if (z != map->clipZ) {
296 *depths = map->tileZ;
300 *depths = (map->region.depths - 1) % map->tileZ + 1;
301 *zRedundant = map->tileZ - *depths;
308 return *depths * *cols * *rows;
329 return ((north >= map->region.south) && (north <= map->region.north) &&
330 (east >= map->region.west) && (east <= map->region.east) &&
331 (((top >= map->region.bottom) && (top <= map->region.top)) ||
332 ((top <= map->region.bottom) && (top >= map->region.top))));
356 int *x,
int *
y,
int *z)
361 *y = (north - map->region.south) / (map->region.north -
363 (map->region.rows - 1);
364 *x = (east - map->region.west) / (map->region.east -
365 map->region.west) * (map->region.cols -
367 *z = (top - map->region.bottom) / (map->region.top -
368 map->region.bottom) *
369 (map->region.depths - 1);