def test_from_points(arrays): points = Points(arrays) assume(not points.are_collinear(tol=1)) # The plane must contain each point. plane = Plane.from_points(*points) points = points.set_dimension(plane.dimension) for point in points: assert plane.contains_point(point, abs_tol=ATOL) # The plane of best fit should be the same # as the plane from three points. plane_fit = Plane.best_fit(points) assert plane_fit.is_close(plane, abs_tol=ATOL)
def test_from_points_failure(point_a, point_b, point_c): with pytest.raises(Exception): Plane.from_points(point_a, point_b, point_c)
def test_from_points(point_a, point_b, point_c, plane_expected): plane = Plane.from_points(point_a, point_b, point_c) assert plane.point.is_close(plane_expected.point) assert plane.is_close(plane_expected)
def test_from_points_failure(point_a, point_b, point_c): message_expected = "The points must not be collinear." with pytest.raises(ValueError, match=message_expected): Plane.from_points(point_a, point_b, point_c)