mirror of
https://github.com/3b1b/manim.git
synced 2025-08-19 13:01:00 +00:00
Fixed edge case in inserting n curves for null curves
This commit is contained in:
parent
b0b71910a5
commit
49d84fccde
1 changed files with 6 additions and 2 deletions
|
@ -710,8 +710,12 @@ class VMobject(Mobject):
|
|||
get_norm(bg[nppc - 1] - bg[0])
|
||||
for bg in bezier_groups
|
||||
])
|
||||
# Insertions per curve
|
||||
ipc = np.round(n * norms / sum(norms)).astype(int)
|
||||
total_norm = sum(norms)
|
||||
# Calculate insertions per curve (ipc)
|
||||
if total_norm < 1e-6:
|
||||
ipc = [n] + [0] * (len(bezier_groups) - 1)
|
||||
else:
|
||||
ipc = np.round(n * norms / sum(norms)).astype(int)
|
||||
diff = n - sum(ipc)
|
||||
for x in range(diff):
|
||||
ipc[np.argmin(ipc)] += 1
|
||||
|
|
Loading…
Add table
Reference in a new issue