def test_join(self): p1 = Point(1, 1, 0) p2 = Point(2, 1, 0) p3 = Point(3, 4, 0) p4 = Point(0, 2, 0) # 3 points assert join(p1, p2, p3).contains(p4) # 2 points l = p1.join(p2) assert l.contains(Point(3, 1, 0)) # two lines m = Line(Point(0, 0, 0), Point(1, 2, 0)) assert join(l, m) == Plane(0, 0, 1, 0) # point and line p = join(l, p3) assert p.contains(p4)
def test_join(self): p1 = Point(1, 1, 4, 0) p2 = Point(2, 1, 5, 0) p3 = Point(3, 4, 6, 0) p4 = Point(0, 2, 7, 0) p5 = Point(1, 5, 8, 0) # 4 points assert join(p1, p2, p3, p4).contains(p5) # 3 points assert join(p1, p2, p3).contains(p3) # two lines l = Line(p1, p2) m = Line(p3, p4) assert join(l, m) == Plane(p1, p2, p3, p4) # coplanar lines l = Line(p1, p2) m = Line(p1, p3) assert join(l, m).contains(p3) # point and line p = join(l, p3) assert p == join(p1, p2, p3) # 2 points l = p1.join(p2) assert l.contains(Point(3, 1, 6, 0))
def test_join(self): # 2 points a = PointCollection([Point(0, 0), Point(0, 1)]) b = PointCollection([Point(1, 0), Point(1, 1)]) assert a.join(b) == LineCollection([Line(0, 1, 0), Line(0, 1, -1)]) # 3 points a = PointCollection([Point(0, 0, 0), Point(0, 0, 1)]) b = PointCollection([Point(1, 0, 0), Point(1, 0, 1)]) c = PointCollection([Point(0, 1, 0), Point(0, 1, 1)]) assert join(a, b, c) == PlaneCollection([Plane(0, 0, 1, 0), Plane(0, 0, 1, -1)]) # two lines l = a.join(b) m = a.join(c) assert join(l, m) == PlaneCollection([Plane(0, 0, 1, 0), Plane(0, 0, 1, -1)]) # point and line assert join(a, b.join(c)) == PlaneCollection( [Plane(0, 0, 1, 0), Plane(0, 0, 1, -1)] )