double radRound(double x) { if (x < -pi) { return x += twoPi; } else if (x > pi) { return x -= twoPi; } return x; }