MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / encode2D

Method encode2D

CesiumGeospatial/src/HilbertOrder.cpp:28–45  ·  view source on GitHub ↗

static*/

Source from the content-addressed store, hash-verified

26} // namespace
27
28/*static*/ uint64_t
29HilbertOrder::encode2D(uint32_t level, uint32_t x, uint32_t y) {
30 uint32_t n = 1U << level;
31
32 CESIUM_ASSERT(x < n && y < n);
33
34 uint64_t index = 0;
35
36 for (uint64_t s = n >> 1; s > 0; s >>= 1) {
37 bool rx = (x & s) > 0;
38 bool ry = (y & s) > 0;
39
40 index += ((3ULL * uint64_t(rx)) ^ uint64_t(ry)) * s * s;
41 rotate(n, x, y, rx, ry);
42 }
43
44 return index;
45}

Callers

nothing calls this directly

Calls 1

rotateFunction · 0.85

Tested by

no test coverage detected