Skip to content

fix(geometry): clamp round_corners cut_off on collinear vertices#4873

Closed
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/3052-round-corners-collinear
Closed

fix(geometry): clamp round_corners cut_off on collinear vertices#4873
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/3052-round-corners-collinear

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • Clamp cut_off_length in Polygram.round_corners to half the shorter adjacent edge
  • Avoids MemoryError when collinear vertices make tan(angle/2) diverge

Fixes #3052

Test plan

  • pytest tests/module/mobject/geometry/test_unit_geometry.py::test_round_corners_collinear_points_stays_finite

Made with Cursor

Prevents tan(angle/2) blow-up when consecutive polygon vertices are
collinear, which could allocate unbounded memory during curve insertion.

Fixes ManimCommunity#3052

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Polygon tries to allocate 8.7 PiB of memory when rounding corners

2 participants