| 262 | } |
| 263 | |
| 264 | EPTkey EPToctree::get_key(const LASpoint* p, const I32 depth) const |
| 265 | { |
| 266 | I32 grid_size = (I32)std::pow(2, depth); |
| 267 | F64 grid_resolution = (xmax - xmin) / grid_size; |
| 268 | |
| 269 | I32 xi = I32_FLOOR((p->get_x() - xmin) / grid_resolution); |
| 270 | I32 yi = I32_FLOOR((p->get_y() - ymin) / grid_resolution); |
| 271 | I32 zi = I32_FLOOR((p->get_z() - zmin) / grid_resolution); |
| 272 | |
| 273 | if (xi < 0) xi = 0; |
| 274 | if (yi < 0) yi = 0; |
| 275 | if (zi < 0) zi = 0; |
| 276 | if (xi >= grid_size) xi = grid_size - 1; |
| 277 | if (yi >= grid_size) yi = grid_size - 1; |
| 278 | if (zi >= grid_size) zi = grid_size - 1; |
| 279 | |
| 280 | return EPTkey(depth, xi, yi, zi); |
| 281 | } |
| 282 | |
| 283 | I32 EPToctree::get_cell(const LASpoint*p, const EPTkey& key) const |
| 284 | { |