Skip to content

Instantly share code, notes, and snippets.

@huckfinnaafb
Created January 6, 2012 23:22
Show Gist options
  • Save huckfinnaafb/1572968 to your computer and use it in GitHub Desktop.
Save huckfinnaafb/1572968 to your computer and use it in GitHub Desktop.
function toIndice(vector, graph_width) {
return (vector.y * graph_width) + vector.x;
}
toIndice({x:4, y:2}, 10);
=> 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment