Skip to content

Instantly share code, notes, and snippets.

@Cranc
Created April 16, 2016 10:48
Show Gist options
  • Save Cranc/65fd8f5bcf6a151c4885e8249d5833af to your computer and use it in GitHub Desktop.
Save Cranc/65fd8f5bcf6a151c4885e8249d5833af to your computer and use it in GitHub Desktop.
// Segment divider (currently at a fixed length)
int div;
int div_c;
float upper_limit;
float bottom_limit;
if (dy < dx)
div_c = Math.abs(dy);
else
div_c = Math.abs(dx);
if (div_c < 10)
div_c = 10;
div = (int) Math.sqrt(Math.pow(Math.abs(dx),2) + Math.pow(Math.abs(dy),2))/div_c;
if(div < 10)
div = 10;
upper_limit = div * 0.66f;
bottom_limit = div * 0.33f;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment