예제 #1
0
def free_path(p1, p2, view, safe_distance=0):
    """Returns if a path is free to traverse assuming that the view is complete and static"""
    for p in view.pedestrians:
        safedistsquare = (safe_distance + p.radius) ** 2
        if linesegdist2(p1, p2, p.position) <= safedistsquare:
            return False

    safedistsquare = safe_distance ** 2
    for o in view.obstacles:
        if line_distance2(p1, p2, o.p1, o.p2) <= safedistsquare:
            return False

    return True
예제 #2
0
def free_path_obstacles_only(p1, p2, view, safe_distance=0):
    safedistsquare = safe_distance ** 2
    for o in view.obstacles:
        if line_distance2(p1, p2, o.p1, o.p2) <= safedistsquare:
            return False
    return True