Ejemplo n.º 1
0
def repulsive_force(point_to_test, point_obstacle, polygon_obs):
    distance = point_to_test.find_distance_between_points(point_obstacle)
    repulsive_vector = Point(0, 0)
    if distance <= REPULSIVE_RANGE:
        repulsive_magnitude = (0.5*REPULSIVE_COEFFICIENT)*((1/REPULSIVE_RANGE) + (1/distance))*(1/distance**2)
        repulsive_vector.set_x((point_to_test.x - point_obstacle.x) * repulsive_magnitude)
        repulsive_vector.set_y((point_to_test.y - point_obstacle.y) * repulsive_magnitude)

    return repulsive_vector
Ejemplo n.º 2
0
def repulsive_force(point_to_test, obs_distance, polygon_centroid, point_obs):
    # distance_to_obstacle = point_to_test.find_distance_between_points(point_obstacle)
    # distance_to_center = point_to_test.find_distance_between_points(polygon_centroid)
    repulsive_vector = Point(0, 0)
    # abs_distance = distance_to_center - distance_to_obstacle
    # if abs_distance <= REPULSIVE_RANGE:
    repulsive_magnitude = REPULSIVE_COEFFICIENT * (1 / (obs_distance**2))
    # *(1/abs_distance**2)
    vector_magnitude = point_to_test.find_distance_between_points(
        polygon_centroid)
    repulsive_vector.set_x((point_to_test.x - polygon_centroid.x) *
                           repulsive_magnitude / vector_magnitude)
    repulsive_vector.set_y((point_to_test.y - polygon_centroid.y) *
                           repulsive_magnitude / vector_magnitude)

    return repulsive_vector
Ejemplo n.º 3
0
def repulsive_force(point_to_test, point_obstacle, polygon_centroid):
    distance_to_obstacle = point_to_test.find_distance_between_points(
        point_obstacle)
    distance_to_center = point_to_test.find_distance_between_points(
        polygon_centroid)
    repulsive_vector = Point(0, 0)
    abs_distance = distance_to_center - distance_to_obstacle
    if distance_to_center <= REPULSIVE_RANGE:
        repulsive_magnitude = (0.5 * REPULSIVE_COEFFICIENT) * (
            1 / (distance_to_center - 3)**2)
        # *(1/abs_distance**2)
        vector_magnitude = point_to_test.find_distance_between_points(
            polygon_centroid)
        repulsive_vector.set_x((point_to_test.x - polygon_centroid.x) *
                               repulsive_magnitude / vector_magnitude)
        repulsive_vector.set_y((point_to_test.y - polygon_centroid.y) *
                               repulsive_magnitude / vector_magnitude)

    return repulsive_vector