| 352 | |
| 353 | template <typename PointT> |
| 354 | inline void PatchWork<PointT>::initialize(RegionwisePatches &patches, |
| 355 | const ConcentricZoneModel &zone_model) { |
| 356 | patches.clear(); |
| 357 | patch_indices_.clear(); |
| 358 | Patch<PointT> patch; |
| 359 | |
| 360 | // Reserve memory in advance to boost speed |
| 361 | patch.cloud_.reserve(1000); |
| 362 | patch.ground_.reserve(1000); |
| 363 | patch.non_ground_.reserve(1000); |
| 364 | |
| 365 | // In polar coordinates, `num_columns` are `num_sectors` |
| 366 | // and `num_rows` are `num_rings`, respectively |
| 367 | int num_rows = zone_model_.num_total_rings_; |
| 368 | const auto &num_sectors_per_ring = zone_model.num_sectors_per_ring_; |
| 369 | |
| 370 | for (int j = 0; j < num_rows; j++) { |
| 371 | Ring ring; |
| 372 | patch.ring_idx_ = j; |
| 373 | patch.is_close_to_origin_ = j < zone_model.max_ring_index_in_first_zone; |
| 374 | for (int i = 0; i < num_sectors_per_ring[j]; i++) { |
| 375 | patch.sector_idx_ = i; |
| 376 | ring.emplace_back(patch); |
| 377 | |
| 378 | patch_indices_.emplace_back(j, i); |
| 379 | } |
| 380 | patches.emplace_back(ring); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | template <typename PointT> |
| 385 | inline void PatchWork<PointT>::flush_patches(RegionwisePatches &patches) { |