public void Polygon_Contains_ContainsOnInside_Touches() { List<LineSegment> bounds = new List<LineSegment>(); bounds.Add(new LineSegment(Point.Origin, Point.MakePointWithInches(-1, 5, 0))); bounds.Add(new LineSegment(Point.Origin, Point.MakePointWithInches(-4, 2, 0))); bounds.Add(new LineSegment(Point.MakePointWithInches(-4, 2, 0), Point.MakePointWithInches(-5, 5, 0))); bounds.Add(new LineSegment(Point.MakePointWithInches(-1, 5, 0), Point.MakePointWithInches(-5, 5, 0))); Polygon testPolygon = new Polygon(bounds); Point insidePlane1 = Point.MakePointWithInches(-2, 2, 0); Point insidePlane2 = Point.MakePointWithInches(-2, 2, 1); Point center1 = testPolygon.CenterPoint; //make sure the sides are not included Point sideTest = Point.Origin; List<LineSegment> lineSegments = new List<LineSegment>(); lineSegments.Add(new LineSegment(Point.MakePointWithInches(0, 2, 3), Point.MakePointWithInches(-3, -2, 0))); lineSegments.Add(new LineSegment(Point.MakePointWithInches(-3, -2, 0), Point.MakePointWithInches(1, 1, -1))); lineSegments.Add(new LineSegment(Point.MakePointWithInches(1, 1, -1), Point.MakePointWithInches(0, 2, 3))); Polygon testPolygon2 = new Polygon(lineSegments); //make sure the PlaneRegion contains the CenterPoint Point center2 = testPolygon2.CenterPoint; Point notOnPlane = center2.Shift(new Shift(Point.MakePointWithInches(.5, 0, 0))); //Points on the plane not boundaries (true for exclusive and inclusive, false for touching) testPolygon.ContainsOnInside(insidePlane1).Should().BeTrue(); testPolygon.Contains(insidePlane1).Should().BeTrue(); testPolygon.Touches(insidePlane1).Should().BeFalse(); testPolygon.ContainsOnInside(insidePlane2).Should().BeFalse(); testPolygon.Contains(insidePlane2).Should().BeFalse(); testPolygon.Touches(insidePlane2).Should().BeFalse(); //make sure the PlaneRegion contains the CenterPoint (true for exclusive and inclusive, false for touching) testPolygon.ContainsOnInside(center1).Should().BeTrue(); testPolygon.Contains(center1).Should().BeTrue(); testPolygon.Touches(center1).Should().BeFalse(); testPolygon2.ContainsOnInside(center2).Should().BeTrue(); testPolygon2.Contains(center2).Should().BeTrue(); testPolygon2.Touches(center2).Should().BeFalse(); //check the side point (true for inclusive and touches, false for exclusive) testPolygon.ContainsOnInside(sideTest).Should().BeFalse(); testPolygon.Contains(sideTest).Should().BeTrue(); testPolygon.Touches(sideTest).Should().BeTrue(); //not on plane (false for all) testPolygon2.ContainsOnInside(notOnPlane).Should().BeFalse(); testPolygon2.Contains(notOnPlane).Should().BeFalse(); testPolygon2.Touches(notOnPlane).Should().BeFalse(); }