Esempio n. 1
0
        public void DegToRadTest()
        {
            float angle    = 100;
            float expected = (float)(angle * (Math.PI / 180));
            float result   = SharedUtilities.DegToRad(angle);

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void GetCenterAngleTest()
        {
            Paddle paddle = new NormalPaddle(0, PaddleDataFactory.GetPaddleData(PaddleType.Normal));

            Assert.IsTrue(SharedUtilities.DegToRad(paddle.AngularPosition + paddle.AngularSize / 2f) == paddle.GetCenterAngle());
        }
Esempio n. 4
0
 public float GetCenterAngle()
 {
     return(SharedUtilities.DegToRad(AngularPosition + AngularSize / 2f));
 }
Esempio n. 5
0
 public void DegToRadTest()
 {
     Assert.IsTrue(SharedUtilities.DegToRad(0) == 0);
 }