public void Angle180() { float error = 1e-4f; Vector2f v = new Vector2f(1, 0); for (int i = 0; i <= 360; i++) { double di = i / 360.0f; double theta = 2.0 * Math.PI * di; float x = (float)Math.Cos(theta); float y = (float)Math.Sin(theta); int j = (i > 180) ? 360 - i : i; Assert.IsTrue(NearlyEqual(j, Vector2f.Angle180(v, new Vector2f(x, y)), error)); } v = new Vector2f(1, -1); for (int i = 0; i <= 360; i++) { double di = i / 360.0f; double theta = 2.0 * Math.PI * di; float x = (float)Math.Cos(theta); float y = (float)Math.Sin(theta); int j = (i + 45) % 360; j = (j > 180) ? 360 - j : j; Assert.IsTrue(NearlyEqual(j, Vector2f.Angle180(v, new Vector2f(x, y)), error)); } }