FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
rtree_builder.hpp File Reference
#include <fcb/packed_rtree.hpp>
#include <cstdint>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  fcb
 

Functions

std::uint32_t fcb::hilbert (std::uint32_t x, std::uint32_t y)
 The Hilbert curve index of point (x, y) on a 65536x65536 grid (16 bits per axis).
 
std::uint32_t fcb::hilbert_bbox (const NodeItem &r, std::uint32_t hilbert_max, const NodeItem &extent)
 A NodeItem's Hilbert index: its bbox center, scaled into [0, hilbert_max] against extent, fed through hilbert.
 
void fcb::hilbert_sort (std::vector< NodeItem > &items, const NodeItem &extent)
 Sorts items in place by descending Hilbert index (the item furthest along the curve first) – a STABLE sort, matching Rust's slice sort_by guarantee.
 
NodeItem fcb::calc_extent (const std::vector< NodeItem > &nodes)
 The bbox union of every item, via repeated NodeItem::expand starting from NodeItem::empty(0).
 
std::vector< NodeItemfcb::build_packed_rtree (const std::vector< NodeItem > &nodes, const NodeItem &extent, std::uint16_t node_size)
 Builds the full flat packed-R-tree node array (leaves first in nodes's own order at the array's tail per rtree_level_bounds, then every internal level above it, bottom-up) from already Hilbert-sorted leaf nodes with their FINAL byte offsets already set.
 
std::vector< std::uint8_t > fcb::encode_packed_rtree (const std::vector< NodeItem > &tree)
 Serializes every node in tree (as returned by build_packed_rtree) in array order, 40 bytes each.