* For each position < n, this function will return -1, 0, or 1, * depending on whether the position is closer to the beginning, middle, or end, respectively. * It is guaranteed that the output will be balanced in that the total for positions 0 through n-1 will be zero. */
| 17 | * It is guaranteed that the output will be balanced in that the total for positions 0 through n-1 will be zero. |
| 18 | */ |
| 19 | static int symmetricalTrichotomy(int position, int n) { |
| 20 | return int(3+2.875*position/(n-1)-1.4375+.5)-3; |
| 21 | } |
| 22 | |
| 23 | static bool isCorner(const Vector2 &aDir, const Vector2 &bDir, double crossThreshold) { |
| 24 | return dotProduct(aDir, bDir) <= 0 || fabs(crossProduct(aDir, bDir)) > crossThreshold; |
no outgoing calls
no test coverage detected