|
morton-arithmetic 0.1.0
Fast Morton (Z-order) codes with O(1) arithmetic
|
Region traversal built on the arithmetic core (row-major and Z-order sweeps). More...

Go to the source code of this file.
Namespaces | |
| namespace | morton |
| namespace | morton::detail |
Functions | |
| template<unsigned Dim, unsigned Bits, typename Fn > | |
| void | morton::for_each_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Fn &&fn) |
| Visit every cell of the inclusive box [lo, hi] in row-major order (axis 0 varies fastest). | |
| template<unsigned Dim, unsigned Bits> | |
| MORTON_HD Morton< Dim, Bits >::code_type | morton::detail::bigmin (typename Morton< Dim, Bits >::code_type zmin, typename Morton< Dim, Bits >::code_type zmax, typename Morton< Dim, Bits >::code_type z) |
| template<unsigned Dim, unsigned Bits> | |
| MORTON_HD void | morton::detail::litmax_bigmin (typename Morton< Dim, Bits >::code_type zmin, typename Morton< Dim, Bits >::code_type zmax, typename Morton< Dim, Bits >::code_type z, typename Morton< Dim, Bits >::code_type &litmax, typename Morton< Dim, Bits >::code_type &bigmin) |
| template<unsigned Dim, unsigned Bits> | |
| bool | morton::bigmin_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > probe, Morton< Dim, Bits > &out) |
Smallest Morton code in the inclusive box [lo, hi] that is strictly greater than probe. | |
| template<unsigned Dim, unsigned Bits> | |
| bool | morton::litmax_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > probe, Morton< Dim, Bits > &out) |
Largest Morton code in the inclusive box [lo, hi] that is strictly less than probe. | |
| template<unsigned Dim, unsigned Bits> | |
| MORTON_HD bool | morton::in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > m) |
Test whether m lies inside the inclusive box [lo, hi]. | |
| template<unsigned Dim, unsigned Bits, typename Fn > | |
| void | morton::for_each_in_box_zorder (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Fn &&fn) |
| Visit every cell of the inclusive box [lo, hi] in Z-order (increasing Morton code), skipping the gaps between rows with BIGMIN. | |
Region traversal built on the arithmetic core (row-major and Z-order sweeps).
Two strategies:
for_each_in_box — row-major (lexicographic) order, advancing with O(1) axis arithmetic so no cell is ever re-encoded from scratch. The cheapest way to sweep a dense axis-aligned region.for_each_in_box_zorder — visits exactly the cells of the region but in Z-order, using the Tropf-Herzog BIGMIN algorithm to skip the gaps between rows. Useful when you need results already sorted by Morton code (range queries on a Z-ordered index).SPDX-License-Identifier: MIT