[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)); }
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)); }
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)); }
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)); }
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)); }
[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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
[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())); }
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())); }