Example #1
0
        public void TestGetLineFromVectors_Points()
        {
            var p          = new Tuple <double, double>(-1, 3);
            var q          = new Tuple <double, double>(2, -1);
            var testResult = LinearEquation.GetLineFromVectors(p, q);

            Console.WriteLine(testResult);
            Assert.IsTrue(new LinearEquation(-1.333333, 1.666667).Equals(testResult));
        }
Example #2
0
        public void TestGetLineFromVectors()
        {
            //treating these like points
            var p          = new LinearEquation(2, 2);
            var q          = new LinearEquation(6, 4);
            var testResult = LinearEquation.GetLineFromVectors(p, q);

            Console.WriteLine(testResult);
            Assert.IsTrue(new LinearEquation(0.5, 1).Equals(testResult));
        }
Example #3
0
        public void TestGetReciprocal()
        {
            //treat these as points
            var p = new LinearEquation(-1, 3);
            var q = new LinearEquation(2, -1);
            var r = new LinearEquation(5, 5);

            //the line determined by points p & q
            var ln = LinearEquation.GetLineFromVectors(p, q);

            Console.WriteLine(ln);
            Assert.IsTrue(new LinearEquation(-1.333333, 1.666667).Equals(ln));
            var recipLn = ln.GetReciprocal(r);

            Console.WriteLine(recipLn);
            Assert.IsTrue(new LinearEquation(0.75, 1.25).Equals(recipLn));
        }