MCPcopy Create free account
hub / github.com/CompVis/zigma / gilbert_xy2d

Function gilbert_xy2d

utils/utils_gilbert.py:9–18  ·  view source on GitHub ↗

Generalized Hilbert ('gilbert') space-filling curve for arbitrary-sized 2D rectangular grids. Takes a discrete 2D coordinate and maps it to the index position on the gilbert curve.

(x, y, w, h)

Source from the content-addressed store, hash-verified

7
8
9def gilbert_xy2d(x, y, w, h):
10 """
11 Generalized Hilbert ('gilbert') space-filling curve for arbitrary-sized
12 2D rectangular grids. Takes a discrete 2D coordinate and maps it to the
13 index position on the gilbert curve.
14 """
15
16 if w >= h:
17 return gilbert_xy2d_r(0, x, y, 0, 0, w, 0, 0, h)
18 return gilbert_xy2d_r(0, x, y, 0, 0, 0, h, w, 0)
19
20
21def sgn(x):

Callers 1

gilbert_zigzag_pathFunction · 0.70

Calls 1

gilbert_xy2d_rFunction · 0.70

Tested by

no test coverage detected