mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Reimplement stretch_array_to_length
This commit is contained in:
parent
c87b2e272b
commit
6c0f00b4a1
1 changed files with 1 additions and 4 deletions
|
@ -81,10 +81,7 @@ def listify(obj):
|
|||
|
||||
|
||||
def stretch_array_to_length(nparray, length):
|
||||
curr_len = len(nparray)
|
||||
if curr_len > length:
|
||||
raise Warning("Trying to stretch array to a length shorter than its own")
|
||||
indices = np.arange(0, curr_len, curr_len / length).astype(int)
|
||||
indices = np.arange(length) * len(nparray) // length
|
||||
return nparray[indices]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue