Example #1
0
        public void CalculateForLeftReturnsCounterclockwiseTest()
        {
            var startPoint = new Point(1,
                                       0);
            var endPoint = new Point(0,
                                     0);
            var line = new Line(startPoint,
                                endPoint);
            var point = new Point(-1,
                                  -1);

            Constants.TurnDirection actual = m_Calculator.Calculate(line,
                                                                    point);

            Assert.AreEqual(Constants.TurnDirection.Counterclockwise,
                            actual);
        }
Example #2
0
        public void Setup()
        {
            m_Line = new Line(new Point(0.0,
                                        0.0),
                              new Point(10.0,
                                        10.0));
            m_Point = new Point(5.0,
                                0.0);

            m_Calculator = new LineDirectionCalculator
            {
                Line  = m_Line,
                Point = m_Point
            };

            m_Calculator.Calculate();
        }
Example #3
0
        public void LessEpsilonSlopeTest()
        {
            const double halfEpsilon = SelkieConstants.EpsilonDistance / 2.0;

            var line = new Line(new Point(0.0,
                                          0.0),
                                new Point(halfEpsilon,
                                          halfEpsilon));
            var point = new Point(5.0,
                                  0.0);

            var calculator = new LineDirectionCalculator
            {
                Line  = line,
                Point = point
            };

            calculator.Calculate();

            // todo figure out what needs to be asserted here
        }
Example #4
0
        public void DirectionForLeftReturnsCounterclockwiseTest()
        {
            var startPoint = new Point(1,
                                       0);
            var endPoint = new Point(0,
                                     0);
            var line = new Line(startPoint,
                                endPoint);
            var point = new Point(-1,
                                  -1);

            var calculator = new LineDirectionCalculator
            {
                Line  = line,
                Point = point
            };

            calculator.Calculate();

            Assert.AreEqual(Constants.TurnDirection.Counterclockwise,
                            calculator.Direction);
        }
Example #5
0
        public void DirectionForZeroTest()
        {
            var startPoint = new Point(1,
                                       0);
            var endPoint = new Point(0,
                                     0);
            var line = new Line(startPoint,
                                endPoint);
            var point = new Point(-1,
                                  0);

            var calculator = new LineDirectionCalculator
            {
                Line  = line,
                Point = point
            };

            calculator.Calculate();

            Assert.AreEqual(Constants.TurnDirection.Unknown,
                            calculator.Direction);
        }