ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
point_lod.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7// Voxel LOD for `GET /api/v1/clouds/{name}/points?max_points=N` (#320).
8//
9// Paging answers "the first N points of this cloud". A viewport wants "all of
10// this cloud, coarsely" — those are different questions, and this file answers
11// the second one. The rationale, the alternatives that were rejected, and the
12// forward path to a precomputed progressive ordering are in
13// docs/gui/binary-points.md § "Level of detail".
14//
15// Deliberately framework-free, like gui/binary_points.hpp: a ProjectDB and a
16// budget in, a page of storage records out. The HTTP layer (gui/api.cpp) turns
17// that page into RUXP or JSON with the same encoders a paged read uses.
18
19// ProjectDB is included rather than forward-declared: this header returns the
20// nested ProjectDB::CloudPage by value, which needs the complete class.
21#include <reusex/core/ProjectDB.hpp>
22
23#include <cstdint>
24#include <string_view>
25#include <vector>
26
27namespace rux::gui {
28
34inline constexpr uint64_t kLodStreamChunk = 262144;
35
45
51 std::vector<uint64_t> indices;
52
56 bool subsampled = false;
57
60 double voxel_size = 0.0;
61
65 uint64_t skipped_non_finite = 0;
66};
67
72bool lod_supports(std::string_view point_type);
73
100LodSelection voxel_lod(const reusex::ProjectDB &db, std::string_view name,
101 uint64_t max_points);
102
121gather_points(const reusex::ProjectDB &db, std::string_view name,
122 const std::vector<uint64_t> &indices);
123
124} // namespace rux::gui
bool lod_supports(std::string_view point_type)
True when point_type carries the xyz positions the grid bins.
reusex::ProjectDB::CloudPage gather_points(const reusex::ProjectDB &db, std::string_view name, const std::vector< uint64_t > &indices)
Read the records of name at indices, as one page.
constexpr uint64_t kLodStreamChunk
Points read from storage per streaming step while selecting.
Definition point_lod.hpp:34
LodSelection voxel_lod(const reusex::ProjectDB &db, std::string_view name, uint64_t max_points)
Select a spatially representative subset of a whole cloud.
A contiguous window of one cloud's stored records, still in storage layout — no PCL type has been inf...
The outcome of a voxel selection over one whole cloud.
Definition point_lod.hpp:37
bool subsampled
False when the cloud already fit the budget and every point was returned.
Definition point_lod.hpp:56
reusex::ProjectDB::CloudPage page
The selected records, in storage layout, ascending by point index.
Definition point_lod.hpp:44
double voxel_size
Edge length of the final voxel, in cloud units (metres for a scan).
Definition point_lod.hpp:60
uint64_t skipped_non_finite
Points skipped because a coordinate was NaN or infinite.
Definition point_lod.hpp:65
std::vector< uint64_t > indices
Storage indices of the selected points, ascending and unique.
Definition point_lod.hpp:51