Skip to content

Commit

Permalink
[fix] : when approaching the frame edges points the laser to other side
Browse files Browse the repository at this point in the history
  • Loading branch information
HyanFerraz committed May 16, 2024
1 parent 67576ec commit 8a8442e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,22 @@
next_position = (current_center[0] + movement_vector[0], current_center[1] + movement_vector[1])

if next_position[0] > current_center[0]:
if (cat_right_edge + 75) > right_edge:
laser_x = cat_left_edge - (laser_offset_x * movement_vector[0]) - 50
laser_y = cat_bottom_edge + movement_vector[1]
cv2.circle(frame, (int(laser_x), int(laser_y)), 5, (255, 255, 255), -1)

laser_offset_x = 2

laser_x = cat_right_edge + (laser_offset_x * movement_vector[0]) + 50
laser_y = cat_bottom_edge + movement_vector[1]
cv2.circle(frame, (int(laser_x), int(laser_y)), 5, (255, 255, 255), -1)
else:
else:
if (cat_left_edge - 75) < left_edge:
laser_x = cat_right_edge + (laser_offset_x * movement_vector[0]) + 50
laser_y = cat_bottom_edge + movement_vector[1]
cv2.circle(frame, (int(laser_x), int(laser_y)), 5, (255, 255, 255), -1)

laser_offset_x = -2

laser_x = cat_left_edge - (laser_offset_x * movement_vector[0]) - 50
Expand Down

0 comments on commit 8a8442e

Please sign in to comment.