public void DegToRadTest() { float angle = 100; float expected = (float)(angle * (Math.PI / 180)); float result = SharedUtilities.DegToRad(angle); Assert.AreEqual(expected, result); }
public static void FillNgonAtCenter(this Graphics g, Brush b, int n, float x, float y, float diameter = 10, float phase = 0) { float radius = diameter / 2f; PointF[] points = new PointF[n]; float angle = SharedUtilities.DegToRad(phase); float deltaAngle = SharedUtilities.PI * 2f / n; for (int i = 0; i < n; i++) { points[i] = new PointF( x + radius * SharedUtilities.CosF(angle), y + radius * SharedUtilities.SinF(angle)); angle += deltaAngle; } g.FillPolygon(b, points); }
public void GetCenterAngleTest() { Paddle paddle = new NormalPaddle(0, PaddleDataFactory.GetPaddleData(PaddleType.Normal)); Assert.IsTrue(SharedUtilities.DegToRad(paddle.AngularPosition + paddle.AngularSize / 2f) == paddle.GetCenterAngle()); }
public float GetCenterAngle() { return(SharedUtilities.DegToRad(AngularPosition + AngularSize / 2f)); }
public void DegToRadTest() { Assert.IsTrue(SharedUtilities.DegToRad(0) == 0); }