Skip to content

Instantly share code, notes, and snippets.

@oliverbooth
Created November 15, 2014 23:19
Show Gist options
  • Select an option

  • Save oliverbooth/0426cd20cb95661e709b to your computer and use it in GitHub Desktop.

Select an option

Save oliverbooth/0426cd20cb95661e709b to your computer and use it in GitHub Desktop.
Useful calculation to turn INDEX into X/Y-coordinates and vice-versa
i = x + (y * w)
x = i % w
y = i / w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment