def test_step(next_points: Sequence[Point]) -> None: points = next_points[:-1] next_point = next_points[-1] result = delaunay_triangles(points) next_result = delaunay_triangles(next_points) assert len(result) <= len(next_result) + 2 assert all(triangle not in next_result for triangle in result if is_point_inside_circumcircle(*triangle, next_point))
def test_sizes(points: Sequence[Point]) -> None: result = delaunay_triangles(points) assert 0 < len(result) <= (2 * (len(points) - 1) - len(to_convex_hull(points))) assert all(len(element) == 3 for element in result)
def test_connection_with_delaunay_triangles(contour: Contour) -> None: result = constrained_delaunay_triangles(contour) assert ((result == delaunay_triangles(contour)) is is_convex_contour(contour))
def test_base_case(triangle: Triangle) -> None: result = delaunay_triangles(triangle) assert len(result) == 1 assert normalize_contour(triangle) in result
def test_boundary(points: Sequence[Point]) -> None: result = delaunay_triangles(points) assert (to_boundary_endpoints(result) == set(map(frozenset, contour_to_segments(to_convex_border(points)))))
def test_delaunay_criterion(points: Sequence[Point]) -> None: result = delaunay_triangles(points) assert all(not any(is_point_inside_circumcircle(*triangle_contour, point) for triangle_contour in result) for point in points)
def test_basic(points: Sequence[Point]) -> None: result = delaunay_triangles(points) assert isinstance(result, list) assert all(isinstance(element, tuple) for element in result)