Esempio n. 1
0
        [TestCase(2.1, ExpectedResult = 2)] // Top of segment
        public static double IntersectionPointY_Horizontal(double xPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(2, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(3, 2);

            return(LineToLineIntersection.IntersectionPointY(xPtN, ptI, ptJ));
        }
Esempio n. 2
0
        public static bool PointIsBelowSegmentIntersection_Outside_Segment(double yPtN, double yIntersection)
        {
            CartesianCoordinate vertexI = new CartesianCoordinate(1, -1);
            CartesianCoordinate vertexJ = new CartesianCoordinate(2, 1);

            return(LineToLineIntersection.PointIsBelowSegmentIntersection(yPtN, yIntersection, vertexI, vertexJ));
        }
Esempio n. 3
0
        public static bool PointIsLeftOfSegmentIntersection_Outside_Segment(double xPtN, double xIntersection)
        {
            CartesianCoordinate vertexI = new CartesianCoordinate(-1, 1);
            CartesianCoordinate vertexJ = new CartesianCoordinate(1, 2);

            return(LineToLineIntersection.PointIsLeftOfSegmentIntersection(xPtN, xIntersection, vertexI, vertexJ));
        }
Esempio n. 4
0
        public static void IntersectionPointY_Vertical_Throws_Argument_Exception()
        {
            CartesianCoordinate ptI = new CartesianCoordinate(2, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(2, 4);

            Assert.Throws <ArgumentException>(() => LineToLineIntersection.IntersectionPointY(2, ptI, ptJ));
        }
Esempio n. 5
0
        public static bool PointIsBelowLineBottomExclusive_On_Ends(double yPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(1, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(15, 5);

            return(LineToLineIntersection.PointIsBelowLineBottomExclusive(yPtN, ptI, ptJ));
        }
Esempio n. 6
0
        [TestCase(2.1, ExpectedResult = 2)] // Right of segment
        public static double IntersectionPointX_Vertical(double yPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(2, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(2, 3);

            return(LineToLineIntersection.IntersectionPointX(yPtN, ptI, ptJ));
        }
Esempio n. 7
0
        public static bool PointIsLeftOfLineEndExclusive_On_Ends(double xPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(1, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(15, 5);

            return(LineToLineIntersection.PointIsLeftOfLineEndExclusive(xPtN, ptI, ptJ));
        }
Esempio n. 8
0
        public static bool PointIsBelowLineBottom_SlopedLine(double yPtN, double yBottomEnd, double yTopEnd)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(10, yBottomEnd);
            CartesianCoordinate ptJ = new CartesianCoordinate(20, yTopEnd);

            return(LineToLineIntersection.PointIsBelowLineBottomInclusive(yPtN, ptI, ptJ));
        }
Esempio n. 9
0
        public static bool PointIsWithinLineWidth_On_Ends_with_Ends_Excluded(double xPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(1, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(15, 5);

            return(LineToLineIntersection.PointIsWithinLineWidthExclusive(xPtN, ptI, ptJ));
        }
Esempio n. 10
0
        public static bool PointIsLeftOfLineEnd_SlopedLine(double xPtN, double xLeftEnd, double xRightEnd)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(xLeftEnd, 10);
            CartesianCoordinate ptJ = new CartesianCoordinate(xRightEnd, 20);

            return(LineToLineIntersection.PointIsLeftOfLineEndInclusive(xPtN, ptI, ptJ));
        }
Esempio n. 11
0
        public static bool PointIsWithinLineWidth_Sloped(double xPtN, double xLeftEnd, double xRightEnd)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(xLeftEnd, 1);
            CartesianCoordinate ptJ = new CartesianCoordinate(xRightEnd, 15);

            return(LineToLineIntersection.PointIsWithinLineWidthInclusive(xPtN, ptI, ptJ));
        }
Esempio n. 12
0
        public static bool PointIsWithinLineHeightInclusive_On_Ends(double yPtN)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(1, 2);
            CartesianCoordinate ptJ = new CartesianCoordinate(15, 5);

            return(LineToLineIntersection.PointIsWithinLineHeightInclusive(yPtN, ptI, ptJ));
        }
Esempio n. 13
0
        public static bool PointIsWithinLineHeight_SlopedLine(double yPtN, double yLeftEnd, double yRightEnd)
        {
            CartesianCoordinate ptI = new CartesianCoordinate(1, yLeftEnd);
            CartesianCoordinate ptJ = new CartesianCoordinate(15, yRightEnd);

            return(LineToLineIntersection.PointIsWithinLineHeightInclusive(yPtN, ptI, ptJ));
        }
Esempio n. 14
0
        [TestCase(0, -2.1, 2)]  // Outside path but inside re-entrant corner, not aligned with tips
        public static void NumberOfIntersectionsOnHorizontal_Star(double x, double y, int expectedResult)
        {
            CartesianCoordinate point = new CartesianCoordinate(x, y);

            Assert.AreEqual(expectedResult, LineToLineIntersection.NumberOfIntersectionsOnHorizontalProjection(point, star.ToArray()));
        }
Esempio n. 15
0
        public static void NumberOfIntersectionsOnHorizontalProjection_Of_Polyline_Throws_Argument_Exception_for_Path()
        {
            CartesianCoordinate coordinate = new CartesianCoordinate(1, 1);

            Assert.Throws <ArgumentException>(() => LineToLineIntersection.NumberOfIntersectionsOnHorizontalProjection(coordinate, polyline.ToArray()));
        }