Beispiel #1
0
 public complex(double rad, angle arg, string type)
 {
     if (type == "angle")
     {
         this.Re = rad * System.Math.Cos(arg); this.Im = rad * System.Math.Sin(arg);
     }
 }
Beispiel #2
0
        public void InfixEquality()
        {
            var a = new angle(0d);
            var b = new angle(0d);

            Assert.True(a == b);
        }
Beispiel #3
0
        public void FromVectors_PiOnTwo()
        {
            var actual   = new angle(a, b);
            var expected = new angle(math.PI_DBL / 2d);

            Assert.AreEqual(expected.radians, actual.radians, tolerance);
        }
Beispiel #4
0
        public void Inequality()
        {
            var a = new angle(0d);
            var b = new angle(1d);

            Assert.False(a.Equals(b));
        }
Beispiel #5
0
        public void FromDouble_Negative_SevenPiOnTwo()
        {
            var actual   = new angle(-7d * math.PI_DBL / 2d);
            var expected = new angle(math.PI_DBL / 2d);

            Assert.AreEqual(expected.radians, actual.radians, tolerance);
        }
Beispiel #6
0
        public void InfixInequality()
        {
            var a = new angle(0d);
            var b = new angle(1d);

            Assert.True(a != b);
        }
Beispiel #7
0
        public void Equality()
        {
            var a = new angle(0d);
            var b = new angle(0d);

            Assert.True(a.Equals(b));
        }
Beispiel #8
0
        public void FromVectors_Zero()
        {
            var actual   = new angle(a, a);
            var expected = new angle(0d);

            Assert.AreEqual(expected.radians, actual.radians, tolerance);
        }
Beispiel #9
0
        public void FromSingleVector_Signed()
        {
            var actual   = new angle(-b);
            var expected = new angle(-math.PI_DBL / 2d);

            Assert.AreEqual(expected.radians, actual.radians, tolerance);
        }
Beispiel #10
0
        public void Radial_East()
        {
            var actual   = new angle(0d).Radial();
            var expected = xHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #11
0
 public Elements(double a, double e, angle omega, angle theta, Direction direction)
 {
     this.a         = a;
     this.e         = e;
     this.omega     = omega;
     this.theta     = theta;
     this.direction = direction;
 }
Beispiel #12
0
        public void ObjectEquality()
        {
            var a = new angle(0d);
            var b = new angle(1d);

            Assert.True(a.Equals(a));
            Assert.False(a.Equals(b));
        }
Beispiel #13
0
        public void Perpendicular_West()
        {
            var actual   = new angle(math.PI_DBL).Perpendicular();
            var expected = -yHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #14
0
        public void Perpendicular_South()
        {
            var actual   = new angle(-math.PI_DBL / 2d).Perpendicular();
            var expected = xHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #15
0
        public void Perpendicular_East()
        {
            var actual   = new angle(0d).Perpendicular();
            var expected = yHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #16
0
        public void Radial_West()
        {
            var actual   = new angle(math.PI_DBL).Radial();
            var expected = -xHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #17
0
        public void Radial_South()
        {
            var actual   = new angle(-math.PI_DBL / 2d).Radial();
            var expected = -yHat;

            Assert.AreEqual(expected.x, actual.x, tolerance);
            Assert.AreEqual(expected.y, actual.y, tolerance);
        }
Beispiel #18
0
        public void Hashing()
        {
            var a_1 = new angle(0d);
            var a_2 = new angle(0d);
            var b   = new angle(1d);

            Assert.True(a_1.GetHashCode() == a_2.GetHashCode());
            Assert.True(a_1.GetHashCode() != b.GetHashCode());
        }
Beispiel #19
0
        public void From_WorldVector_SouthNegative_WithAngle()
        {
            var theta    = new angle(-math.PI_DBL / 2d);
            var expected = new coordinates(2d, theta);
            var actual   = new coordinates(new double2(0d, -2d));

            Assert.AreEqual(expected.r, actual.r, tolerance);
            Assert.AreEqual(expected.theta.radians, actual.theta.radians, tolerance);
        }
Beispiel #20
0
        public void Formatting()
        {
            const double rad = 1d;
            var          a   = new angle(rad);

            Assert.AreEqual(
                $"{rad} radians",
                a.ToString()
                );
        }
Beispiel #21
0
        public void Formatting()
        {
            var a_r     = 2d;
            var a_theta = new angle(3d);
            var a       = new coordinates(a_r, a_theta.radians);

            Assert.AreEqual(
                $"coordinates(r: {a_r}, theta: {a_theta})",
                a.ToString()
                );
        }
Beispiel #22
0
    private void InputManagement()
    {
        if (Input.GetKey(KeyCode.D))
        {
            direction = angle.right;
        }
        else if (Input.GetKeyUp(KeyCode.D))
        {
            direction = angle.still;
        }

        if (Input.GetKey(KeyCode.A))
        {
            direction = angle.left;
        }
        else if (Input.GetKeyUp(KeyCode.A))
        {
            direction = angle.still;
        }
    }
Beispiel #23
0
 private void RotateLeft()
 {
     if (Input.GetKey(KeyCode.A))
     {
         if (laps > -3)
         {
             transform.localEulerAngles -= new Vector3(0, 0, 1000 * Time.deltaTime);
         }
         left.transform.position  = checkerPosition.position;
         still.transform.position = Vector3.zero;
         right.transform.position = Vector3.zero;
         direction = angle.left;
     }
     else if (Input.GetKeyUp(KeyCode.A))
     {
         still.transform.position = checkerPosition.position;
         right.transform.position = Vector3.zero;
         left.transform.position  = Vector3.zero;
         direction = angle.still;
     }
 }
 => RotatePoint(x, y, angle, ox, oy);
 Vector3 next = points[^ 1].GetPoint2D(angle, StepSize);
Beispiel #26
0
 var(angle, q1) = _args;
 => SplitEllipticalArc1(x, y, rX, rY, angle, startAngle, sweepAngle, t);
Beispiel #28
0
 SDL_RenderCopyEx(this, texture, IntPtr.Zero, dst, angle, IntPtr.Zero, flip);