GEOS 3.11.1
HilbertCode.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15
16#pragma once
17
18#include <geos/export.h>
19#include <string>
20
21// Forward declarations
22namespace geos {
23namespace geom {
24class Coordinate;
25}
26}
27
28namespace geos {
29namespace shape { // geos.shape
30namespace fractal { // geos.shape.fractal
31
64class GEOS_DLL HilbertCode {
65
66public:
67
71 static constexpr int MAX_LEVEL = 16;
72
73 static geom::Coordinate decode(uint32_t level, uint32_t i);
74
75 static uint32_t encode(uint32_t level, uint32_t x, uint32_t y);
76
84 static uint32_t levelSize(uint32_t level);
85
94 static uint32_t maxOrdinate(uint32_t level);
95
103 static uint32_t level(uint32_t numPoints);
104
105
106private:
107
108 static uint32_t deinterleave(uint32_t x);
109
110 static uint32_t interleave(uint32_t x);
111
112 static uint32_t prefixScan(uint32_t x);
113
114 static uint32_t descan(uint32_t x);
115
116 static void checkLevel(uint32_t level);
117
118
119};
120
121
122} // namespace geos.shape.fractal
123} // namespace geos.shape
124} // namespace geos
125
126
127
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Definition: HilbertCode.h:64
static uint32_t maxOrdinate(uint32_t level)
static uint32_t level(uint32_t numPoints)
static uint32_t levelSize(uint32_t level)
Basic namespace for all GEOS functionalities.
Definition: geos.h:39