def test_distance_to_line_is_calculated(self): line = geom3d.Line([0, 0, 0], [1, 0, 0]) assert line.distance_to_point([1, 1, 0]) == 1 assert line.distance_to_point([1, 1, 1]) == np.sqrt(2) assert line.distance_to_point([1, 3, 4]) == 5 line = geom3d.Line([1, 0, 0], [1, 1, 0]) assert line.distance_to_point([3, 2, 4]) == 4 assert line.distance_to_point([0, 1, 0]) == np.sqrt(2)
def test_distance_to_line_can_take_multiple_points(self): line = geom3d.Line([0, 0, 0], [1, 0, 0]) assert_vector_equal(line.distance_to_point([[1, 1, 0], [1, 3, 4]]), [1, 5])
def test_line_contains_anchor_point_and_direction(self): line = geom3d.Line([0, 0, 0], [1, 0, 0]) assert_vector_equal(line.anchor_point, [0, 0, 0]) assert_vector_equal(line.direction, [1, 0, 0])
def test_line_direction_is_normalized(self): line = geom3d.Line([0, 0, 0], [2, 0, 0]) assert_vector_equal(line.direction, [1, 0, 0])
def gen_random_shape(self): return geom3d.Line(np.random.uniform(size=(3, )), np.random.uniform(size=(3, )))