def total_potential_force(att_vector, rep_vector): total_vector = Point(att_vector.x + rep_vector.x, att_vector.y + att_vector.y) return total_vector def potential_get_path(polygon, point_start, point_goal, polygon_centroid): path = [Point(point_start.x, point_start.y)] point_current = Point(point_start.x, point_start.y) step = 0 while point_current.find_distance_between_points(point_goal) >= TARGET_RANGE and step <= TOTAL_STEP: att_vector = attraction_force(point_current, point_goal) point_obstacle = closest_point_to_obstacle(point_current, polygon) # point_obstacle.plot_point() print('current \npoint obstacle\nattraction\nrepulsive') point_current.show_value() point_obstacle.show_value() # print(point_current.find_distance_between_points(point_obstacle)) if point_current.find_distance_between_points(point_obstacle) <= REPULSIVE_RANGE: rep_vector = repulsive_force(point_current, point_obstacle, polygon_centroid) else: rep_vector = Point(0, 0) att_vector.show_value() rep_vector.show_value() total_vector = total_potential_force(att_vector, rep_vector) # force_point = po # point_current.plot_line_between_two_point() # point_current.show_value()