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

Function gilbert_xy2d

utils/utils_zigzag.py:16–25  ·  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

14
15
16def gilbert_xy2d(x, y, w, h):
17 """
18 Generalized Hilbert ('gilbert') space-filling curve for arbitrary-sized
19 2D rectangular grids. Takes a discrete 2D coordinate and maps it to the
20 index position on the gilbert curve.
21 """
22
23 if w >= h:
24 return gilbert_xy2d_r(0, x, y, 0, 0, w, 0, 0, h)
25 return gilbert_xy2d_r(0, x, y, 0, 0, 0, h, w, 0)
26
27
28def sgn(x):

Callers 1

gilbert_zigzag_pathFunction · 0.70

Calls 1

gilbert_xy2d_rFunction · 0.70

Tested by

no test coverage detected