def test_contains(self): a = Point(0, 0) b = Point(0, 2) c = Point(2, 2) d = Point(2, 0) r = Rectangle(a, b, c, d) assert r.contains(a) assert r.contains(b) assert r.contains(c) assert r.contains(d) assert r.contains(Point(1, 1)) assert not r.contains(Point([1, 1, 0])) a = Point(0, 0, 1) b = Point(1, 3, 1) c = Point(2, 0, 1) d = Point(1, 1, 1) p = Polygon(a, b, c, d) assert p.contains(Point(0.5, 1, 1)) assert not p.contains(Point(0.5, 1, 0)) assert np.all( p.contains(PointCollection([Point(0.5, 1, 1), Point(1.5, 1, 1)]))) assert np.all(p.contains(PointCollection([a, c, d]))) t = Triangle(Point(0, 0), Point(0, 2), Point(2, 1)) assert t.contains(Point(1, 1)) assert not t.contains(Point(-1, 1)) assert not t.contains(Point([1, 1, 0]))
def test_contains(self): a = Point(0, 0) b = Point(0, 2) c = Point(2, 1) t = Triangle(a, b, c) assert t.contains(Point(1, 1)) assert all(t.contains(PointCollection([a, b, c]))) assert not t.contains(Point(-1, 1)) assert not t.contains(Point([1, 1, 0]))