[Arc / Ellipse / Circle] gracefully handle large arclen

This commit is contained in:
Jan Petykiewicz 2026-03-31 21:42:16 -07:00
commit 2952e6ef8f
4 changed files with 16 additions and 3 deletions

View file

@ -109,6 +109,19 @@ def test_rotated_arc_bounds_match_polygonized_geometry() -> None:
bounds = arc.get_bounds_single()
poly_bounds = arc.to_polygons(num_vertices=8192)[0].get_bounds_single()
assert_allclose(bounds, poly_bounds, atol=1e-3)
def test_curve_polygonizers_clamp_large_max_arclen() -> None:
for shape in (
Circle(radius=10),
Ellipse(radii=(10, 20)),
Arc(radii=(10, 20), angles=(0, 1), width=2),
):
polys = shape.to_polygons(num_vertices=None, max_arclen=1e9)
assert len(polys) == 1
assert len(polys[0].vertices) >= 3
def test_path_edge_cases() -> None:
# Zero-length segments
p = MPath(vertices=[[0, 0], [0, 0], [10, 0]], width=2)