Esempio n. 1
0
        public void CalculateLineIntersectionBetweenTwoSuperPosedZeroLengthLines()
        {
            // arrange
            var firstLineStartPoint  = new Point(150, 150);
            var firstLineEndPoint    = new Point(150, 150);
            var secondLineStartPoint = new Point(150, 150);
            var secondLineEndPoint   = new Point(150, 150);

            // act
            var intersection = CalculationHelpers.GetLineIntersection(
                firstLineStartPoint,
                firstLineEndPoint,
                secondLineStartPoint,
                secondLineEndPoint);

            // assert
            Assert.IsNull(intersection);
        }
Esempio n. 2
0
        public void CalculateLineIntersectionBetweenTwoNotCrossingLines()
        {
            // arrange
            var firstLineStartPoint  = new Point(50, 700);
            var firstLineEndPoint    = new Point(500, 57);
            var secondLineStartPoint = new Point(49, 699);
            var secondLineEndPoint   = new Point(2, 30);

            // act
            var intersection = CalculationHelpers.GetLineIntersection(
                firstLineStartPoint,
                firstLineEndPoint,
                secondLineStartPoint,
                secondLineEndPoint);

            // assert
            Assert.IsNull(intersection);
        }
Esempio n. 3
0
        public void CalculateLineIntersectionBetweenTwoParallelLines()
        {
            // arrange
            var firstLineStartPoint  = new Point(0, 0);
            var firstLineEndPoint    = new Point(300, 300);
            var secondLineStartPoint = new Point(1, 1);
            var secondLineEndPoint   = new Point(301, 301);

            // act
            var intersection = CalculationHelpers.GetLineIntersection(
                firstLineStartPoint,
                firstLineEndPoint,
                secondLineStartPoint,
                secondLineEndPoint);

            // assert
            Assert.IsNull(intersection);
        }
Esempio n. 4
0
        public void CalculateLineIntersectionBetweenTwoLines()
        {
            // arrange
            var firstLineStartPoint  = new Point(0, 0);
            var firstLineEndPoint    = new Point(300, 300);
            var secondLineStartPoint = new Point(0, 300);
            var secondLineEndPoint   = new Point(300, 0);

            // act
            var intersection = CalculationHelpers.GetLineIntersection(
                firstLineStartPoint,
                firstLineEndPoint,
                secondLineStartPoint,
                secondLineEndPoint);

            // assert
            Assert.IsNotNull(intersection);
            Assert.AreEqual(new Point(150, 150), intersection.Value);
        }