https://github.com/sebastianlipponer/zorder_knn
Floating point morton order comparison operator.
https://github.com/sebastianlipponer/zorder_knn
floating-point ieee754 morton morton-order space-filling-curves z-order
Last synced: 4 months ago
JSON representation
Floating point morton order comparison operator.
- Host: GitHub
- URL: https://github.com/sebastianlipponer/zorder_knn
- Owner: sebastianlipponer
- License: mit
- Created: 2021-05-02T14:10:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-01T10:08:44.000Z (about 2 years ago)
- Last Synced: 2024-05-02T21:12:34.674Z (about 2 years ago)
- Topics: floating-point, ieee754, morton, morton-order, space-filling-curves, z-order
- Language: C++
- Homepage:
- Size: 27.3 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING.MIT
Awesome Lists containing this project
README
# zorder_knn
[](https://github.com/sebastianlipponer/zorder_knn/actions?workflow=build) [](https://github.com/sebastianlipponer/zorder_knn/blob/master/COPYING.MIT)
zorder_knn is a C++ header-only library that implements a floating point morton order comparison operator1 for n-dimensional points.
## Build
Before running CMake, run either build-extern.cmd or build-extern.sh to download and build the necessary external dependencies in the .extern directory. You may skip this step if you don't want to run the unit tests.
## Usage
```
#include
constexpr std::size_t n = 2;
using Point = std:array;
std::vector pts;
// ...
std::sort(pts.begin(), pts.end(), zorder_knn::Less());
```
## Example


_2000 random 2d points whose order is given by a path from start (blue) to end (red). **Left**: random order. **Right**: morton order._
## References
[1] M. Connor and P. Kumar, "Fast construction of k-nearest neighbor graphs for point clouds," in IEEE Transactions on Visualization and Computer Graphics, vol. 16, no. 4, pp. 599-608, July-Aug. 2010, doi: 10.1109/TVCG.2010.9.