From ad20cfabb11bf0b30a6526de24ca3f646fe47cdf Mon Sep 17 00:00:00 2001 From: Leo Stanislas Date: Fri, 21 Jan 2022 10:04:16 -0400 Subject: [PATCH 1/2] Fix inconsistent point_format_id type. --- cpp/include/copc-lib/las/header.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/copc-lib/las/header.hpp b/cpp/include/copc-lib/las/header.hpp index 5c5c7aa6..150021f9 100644 --- a/cpp/include/copc-lib/las/header.hpp +++ b/cpp/include/copc-lib/las/header.hpp @@ -44,7 +44,7 @@ class LasHeader // Getters/Setters for protected attributes - uint8_t PointFormatId() const { return point_format_id_; } + int8_t PointFormatId() const { return point_format_id_; } uint16_t PointRecordLength() const { return point_record_length_; } Vector3 Scale() const { return scale_; } Vector3 Offset() const { return offset_; } From ad51b54ff107c124bd0e7e5e2c14cf876aa0b73a Mon Sep 17 00:00:00 2001 From: Leo Stanislas Date: Fri, 21 Jan 2022 10:08:30 -0400 Subject: [PATCH 2/2] Simplify writer examples. --- example/example-writer.cpp | 5 ++++- example/example-writer.py | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/example/example-writer.cpp b/example/example-writer.cpp index 0cc2a663..1a10cc49 100644 --- a/example/example-writer.cpp +++ b/example/example-writer.cpp @@ -211,7 +211,10 @@ las::Points RandomPoints(const VoxelKey &key, const las::LasHeader &header, int std::uniform_int_distribution<> rand_z(std::ceil(header.ApplyInverseScaleZ(std::max(header.min.z, z_min))), std::floor(header.ApplyInverseScaleZ(std::min(header.max.z, z_min + step)))); - las::Points points(header.PointFormatId(), header.Scale(), header.Offset()); + // Create a Points object based on the LAS header + las::Points points(header); + + // Populate the points for (int i = 0; i < number_points; i++) { // Create a point with a given point format diff --git a/example/example-writer.py b/example/example-writer.py index eb01fe86..2fa738a4 100644 --- a/example/example-writer.py +++ b/example/example-writer.py @@ -186,11 +186,10 @@ def RandomPoints(key, las_header, number_points): miny = las_header.min.y + (step * key.y) minz = las_header.min.z + (step * key.z) - points = copc.Points( - las_header.point_format_id, - las_header.scale, - las_header.offset, - ) + # Create a Points object based on the LAS header + points = copc.Points(las_header) + + # Populate the points for i in range(number_points): # Create a point with a given point format point = points.CreatePoint()