コード例 #1
0
def attraction_force(point_to_test, point_goal):
    vector_magnitude = point_to_test.find_distance_between_points(point_goal)
    attraction_vector = Point(point_goal.x - point_to_test.x,
                              point_goal.y - point_to_test.y)
    attraction_vector.scale_point(ATTRACTION_COEFFICIENT / vector_magnitude)
    return attraction_vector
コード例 #2
0
def attraction_force(point_to_test, point_goal):
    attraction_vector = Point(point_goal.x - point_to_test.x, point_goal.y - point_to_test.y)
    attraction_vector.scale_point(ATTRACTION_COEFFICIENT)
    return attraction_vector