mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
Reimplement stretch_array_to_length
This commit is contained in:
@ -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]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user