Skip to content

Commit

Permalink
exception add if new_rings is none (#3574)
Browse files Browse the repository at this point in the history
* exception add if new_rings is none

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
hydromelvictor and pre-commit-ci[bot] authored Jan 11, 2024
1 parent 3b496ea commit 4e3cfd2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions manim/utils/space_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,14 @@ def earclip_triangulation(verts: np.ndarray, ring_ends: list) -> list:

# Move the ring which j belongs to from the
# attached list to the detached list
new_ring = next(filter(lambda ring: ring[0] <= j < ring[-1], detached_rings))
detached_rings.remove(new_ring)
attached_rings.append(new_ring)
new_ring = next(
(ring for ring in detached_rings if ring[0] <= j < ring[-1]), None
)
if new_ring is not None:
detached_rings.remove(new_ring)
attached_rings.append(new_ring)
else:
raise Exception("Could not find a ring to attach")

# Setup linked list
after = []
Expand Down

0 comments on commit 4e3cfd2

Please sign in to comment.