public void PointOutsidePolygonLeft() { // Arrange PointF point1 = new PointF(-1F, 2F); PointF[] polygon = new PointF[] { new PointF(0F, 0F), new PointF(0F, 8F), new PointF(4F, 4F), new PointF(9F, 7F), new PointF(13F, 0F), }; // Act bool answer = IsPointInsideOrOutsidePolygon.IsPointInPolygon(polygon, point1); // Assert Assert.AreEqual(false, answer); }
public void PointOnBottomBorderOfPolygon() { // Arrange PointF point1 = new PointF(4F, 0F); PointF[] polygon = new PointF[] { new PointF(0F, 0F), new PointF(0F, 8F), new PointF(4F, 4F), new PointF(9F, 7F), new PointF(13F, 0F), }; // Act bool answer = IsPointInsideOrOutsidePolygon.IsPointInPolygon(polygon, point1); // Assert Assert.AreEqual(true, answer); }
public void PointOutsidePolygonWithSelfIntersections() { // Arrange PointF point1 = new PointF(-1F, 2F); PointF[] polygon = new PointF[] { new PointF(3F, 0F), new PointF(2F, -1F), new PointF(1F, 3F), new PointF(-3F, 0F), new PointF(-2F, 2F), new PointF(-1F, 0F), new PointF(0F, 4F), new PointF(1F, 0F), new PointF(2F, 2F), }; // Act bool answer = IsPointInsideOrOutsidePolygon.IsPointInPolygon(polygon, point1); // Assert Assert.AreEqual(false, answer); }