Skip to content

Instantly share code, notes, and snippets.

@keveman
Created May 9, 2011 17:25
Show Gist options
  • Save keveman/962922 to your computer and use it in GitHub Desktop.
Save keveman/962922 to your computer and use it in GitHub Desktop.
Discrete Voronoi
let_(_v = get_<0>(_1)) [
let_(_i = get_<9>(_1)) [
let_(_y = _i/m) [
let_(_x = _i - _y*m) [
if_(_x >= k) [
_v = minVoro_(_x, _y, _v, get_<3>(_1), m, n),
if_(_y >= k) [
_v = minVoro_(_x, _y, _v, get_<8>(_1), m, n)
],
if_(_y+k <= n) [
_v = minVoro_(_x, _y, _v, get_<7>(_1), m, n)
]
],
if_(_x + k < m) [
_v = minVoro_(_x, _y, _v, get_<1>(_1), m, n),
if_(_y >= k) [
_v = minVoro_(_x, _y, _v, get_<6>(_1), m, n)
],
if_(_y+k < n) [
_v = minVoro_(_x, _y, _v, get_<5>(_1), m, n)
]
],
if_(_y >= k) [
_v = minVoro_(_x, _y, _v, get_<4>(_1), m, n)
],
if_(_y+k < n) [
_v = minVoro_(_x, _y, _v, get_<2>(_1), m, n)
]
]
]
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment