예제 #1
0
def test_distance_plane():
    print('pt-plane')
    pt0 = Point(1, 1, 1)
    pt1 = Point(-1, 1, 0)
    pt2 = Point(1, 1, 0)
    pt3 = Point(0, 0, 0)
    print(pt0.distance_to_plane(Plane(pt_1=pt1, pt_2=pt2, pt_3=pt3)))
예제 #2
0
def test_distance_line():
    pt0 = Point(0, 0, 0)
    pt1 = Point(1, 0, 0)
    pt2 = Point(1, 1, 0)
    pt3 = Point(0, 0, 4)
    line = Line(pt_1=pt1, pt_2=pt2)
    print('pt-line')
    print(pt0.distance_to_line(line))
    seg = Segment(pt1, pt2)
    print(pt0.distance_to_segment(seg))
    plane = Plane(pt_1=pt0, pt_2=pt1, pt_3=pt2)
    print(pt3.distance_to_plane(plane))