Chore: Remove the use of np.int

This commit is contained in:
LmeSzinc 2023-05-30 09:59:12 +08:00
parent 27c08df0ca
commit eaaaa7e320
2 changed files with 5 additions and 5 deletions

View File

@ -54,8 +54,8 @@ def random_rectangle_vector(vector, box, random_range=(0, 0, 0, 0), padding=15):
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
center = random_rectangle_point(box)
start_point = center - half_vector
@ -86,8 +86,8 @@ def random_rectangle_vector_opted(
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box_pad = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
box_pad = area_offset(box_pad, half_vector)
segment = int(np.linalg.norm(vector) // 70) + 1

View File

@ -73,7 +73,7 @@ def insert_swipe(p0, p3, speed=15, min_distance=10):
prev = (-100, -100)
for t in ts:
point = p0 * (1 - t) ** 3 + 3 * p1 * t * (1 - t) ** 2 + 3 * p2 * t ** 2 * (1 - t) + p3 * t ** 3
point = point.astype(np.int).tolist()
point = point.astype(int).tolist()
if np.linalg.norm(np.subtract(point, prev)) < min_distance:
continue