示例#1
0
    def test_perpendicular(self):
        p = Point(1, 1, 0)
        q = Point(0, 0, 1)
        r = Point(1, 2, 3)
        l = Line(p, q)
        m = l.perpendicular(p)

        assert l.meet(m) == p
        assert is_perpendicular(l, m)

        m = l.perpendicular(r)

        assert is_perpendicular(l, m)

        e = Plane(l, r)
        m = e.perpendicular(p)

        assert e.meet(m) == p
        assert is_perpendicular(l, m)

        m = e.perpendicular(p + m.direction)

        assert e.meet(m) == p
        assert is_perpendicular(l, m)

        f = e.perpendicular(l)

        assert e.meet(f) == l
        assert is_perpendicular(e, f)
示例#2
0
    def test_perpendicular(self):
        p = Point(1, 1, 0)
        q = Point(0, 0, 1)
        l = Line(p, q)
        m = l.perpendicular(p)

        assert is_perpendicular(l, m)

        r = Point(1, 2, 3)
        e = Plane(p, q, r)
        m = e.perpendicular(p)

        assert is_perpendicular(l, m)