Skip to content

Instantly share code, notes, and snippets.

@kraklin
Created June 25, 2016 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kraklin/6be377e591fa404a505f1e5cd1a5607b to your computer and use it in GitHub Desktop.
Save kraklin/6be377e591fa404a505f1e5cd1a5607b to your computer and use it in GitHub Desktop.
getCoordsForPosition position =
-- first quadrant
if List.member position [1..5] then
{ x = (9 * position - 4.5), y = 41 }
else if List.member position [6..9] then
{ x = 40.5, y = 41 - (position - 5) * 9 }
else if position == 10 then
{ x = 49.5, y = 5 }
-- second quadrant
else if List.member position [11..15] then
{ x = 58.5, y = 0.5 + (9 * (position - 10) - 4.5) }
else if List.member position [16..19] then
{ x = 67.5 + (9 * (position - 16)), y = 41 }
else if position == 20 then
{ x = 94.5, y = 50 }
-- third quadrant
else if List.member position [21..25] then
{ x = 94.5 - (9 * (position - 21)), y = 59 }
else if List.member position [26..29] then
{ x = 58.5, y = 59 + (9 * (position - 25)) }
else if position == 30 then
{ x = 49.5, y = 95 }
-- forth quadrant
else if List.member position [31..35] then
{ x = 40.5, y = 95 - (9 * (position - 31)) }
else if List.member position [36..39] then
{ x = 31.5 - (9 * (position - 36)), y = 59 }
else if position == 40 then
{ x = 4.5, y = 50 }
else
{ x = 200, y = 200 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment