From bd60c9b41329c9a4c62f17edcda186dfbc1c60d4 Mon Sep 17 00:00:00 2001 From: Danil An Date: Tue, 7 Apr 2026 20:34:30 +0400 Subject: [PATCH] fix: load_pc resize -> reserve to prevent duplicate points --- core/src/point_cloud.cpp | 6 +++--- core/src/point_clouds.cpp | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/point_cloud.cpp b/core/src/point_cloud.cpp index f9f4284f..57d14eac 100644 --- a/core/src/point_cloud.cpp +++ b/core/src/point_cloud.cpp @@ -149,9 +149,9 @@ bool PointCloud::load_pc(const std::string& input_file_name, bool load_cache_mod this->intensities.clear(); this->timestamps.clear(); - this->points_local.resize(npoints); - this->intensities.resize(npoints); - this->timestamps.resize(npoints); + this->points_local.reserve(npoints); + this->intensities.reserve(npoints); + this->timestamps.reserve(npoints); while (p_count < npoints) { diff --git a/core/src/point_clouds.cpp b/core/src/point_clouds.cpp index eac47cb8..056958b4 100644 --- a/core/src/point_clouds.cpp +++ b/core/src/point_clouds.cpp @@ -1317,6 +1317,11 @@ bool PointClouds::load_whu_tls( point_clouds[i].points_local[j] -= this->offset; } + size_t total_points = 0; + for (int i = 0; i < point_clouds.size(); i++) + total_points += point_clouds[i].points_local.size(); + std::cout << "total points loaded: " << total_points << std::endl; + print_point_cloud_dimension(); const auto end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start;