Skip to content

Instantly share code, notes, and snippets.

@mmowbray
Created October 5, 2015 23:15
Show Gist options
  • Save mmowbray/22c500f63cceb6c2b6af to your computer and use it in GitHub Desktop.
Save mmowbray/22c500f63cceb6c2b6af to your computer and use it in GitHub Desktop.
int image_width = 4;
int image_height = 5;
for (int y = 0; y < image_height - 1; y++) {
for (int x = 0; x < image_width - 1; x++) {
System.out.println("(" + ((y * image_width) + x) + "," + ((y * image_width) + x + 1) + "," + (x + ((y+1) * image_width)) + ")"); //top triangle indices
System.out.println("(" + ((y * image_width) + x + 1) + "," + (x + 1 + ((y+1) * image_width)) + "," + (x + ((y+1) * image_width)) + ")"); //bottom triangle indices
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment