def _within(p1, p2, d):
    """Determines whether 2 points are within a distance of each other

    Parameters
    ---------
    p1 : Position
        The first point
    p2 : Position
        The second point
    d : int or float
        The distance

    Returns
    ----------
    bool
        Whether the distance between the points is less than d
    """
    return (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2 < d ** 2
