mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
Remove usage of np.append
This commit is contained in:
@ -58,7 +58,7 @@ def color_to_int_rgb(color):
|
||||
|
||||
def color_to_int_rgba(color, opacity=1.0):
|
||||
alpha = int(255 * opacity)
|
||||
return np.append(color_to_int_rgb(color), alpha)
|
||||
return np.array([*color_to_int_rgb(color), alpha])
|
||||
|
||||
|
||||
def color_gradient(reference_colors, length_of_output):
|
||||
|
@ -31,10 +31,10 @@ def quaternion_mult(q1, q2):
|
||||
|
||||
|
||||
def quaternion_from_angle_axis(angle, axis):
|
||||
return np.append(
|
||||
return np.hstack([
|
||||
np.cos(angle / 2),
|
||||
np.sin(angle / 2) * normalize(axis)
|
||||
)
|
||||
])
|
||||
|
||||
|
||||
def angle_axis_from_quaternion(quaternion):
|
||||
@ -65,7 +65,7 @@ def rotate_vector(vector, angle, axis=OUT):
|
||||
quat_inv = quaternion_conjugate(quat)
|
||||
product = reduce(
|
||||
quaternion_mult,
|
||||
[quat, np.append(0, vector), quat_inv]
|
||||
[quat, np.hstack([0, vector]), quat_inv]
|
||||
)
|
||||
return product[1:]
|
||||
else:
|
||||
|
Reference in New Issue
Block a user