示例#1
0
        } // End Property Normalized


        // http://mathworld.wolfram.com/NormalVector.html
        // https://stackoverflow.com/questions/1243614/how-do-i-calculate-the-normal-vector-of-a-line-segment
        public static MyVector2D <T> GetNormalVector(MyVector2D <T> vec)
        {
            MyVector2D <T> normal1 = new MyVector2D <T>(Arithmetics <T> .Minus(vec.Y), vec.X);

            // MyVector2D<T> normal2 = new MyVector2D<T>(vec.Y, Arithmetics<T>.Minus(vec.X));

            return(normal1);
        } // End Function GetNormalVector
示例#2
0
        public void Math_WhenTwoCorrectNumberSubtractIsCorrect_TestShouldPass()
        {
            var math = new Arithmetics();
            int num1;
            int num2;
            int expectedResult;

            num1           = 12;
            num2           = 3;
            expectedResult = 9;

            int actualResult = math.Minus(num1, num2);

            Assert.AreEqual(expectedResult, actualResult);
        }
示例#3
0
        static void Main(string[] args)
        {
            var    math = new Arithmetics();
            int    num1;
            int    num2;
            int    sum;
            int    sub;
            string temp;

            Console.WriteLine("Write first number:");
            temp = Console.ReadLine();
            num1 = int.Parse(temp);

            Console.WriteLine("Write second number:");
            temp = Console.ReadLine();
            num2 = int.Parse(temp);

            sum = math.Add(num1, num2);
            Console.WriteLine($"We added {num1} and {num2} and got --> {sum}");

            sub = math.Minus(num1, num2);
            Console.WriteLine($"We subtract {num1} and {num2} and got --> {sub}");
        }