public void Intersections_2() { IPath shape = new RectangularPolygon(1, 1, 10, 10); IEnumerable <PointF> intersections = shape.FindIntersections(new PointF(0, 5), new PointF(20, 5)); Assert.Equal(2, intersections.Count()); Assert.Equal(new PointF(1, 5), intersections.First()); Assert.Equal(new PointF(11, 5), intersections.Last()); }
public void ClippingEdgefromInside() { IPath simplePath = new RectangularPolygon(10, 10, 100, 100).Clip(new RectangularPolygon(20, 0, 20, 20)); IEnumerable <PointF> intersections = simplePath.FindIntersections(new PointF(float.MinValue, 20), new PointF(float.MaxValue, 20)); // returns an even number of points Assert.Equal(4, intersections.Count()); }