public boolean isNear(double x, double y, double zoom) {
        double distance = Math.abs(dist(x, y));
        if (zoom >= 0 && distance > 5.0 / Math.sqrt(zoom))
            return false;
        double d = (from.getX() - to.getX()) * (from.getX() - to.getX())
                + (from.getY() - to.getY()) * (from.getY() - to.getY());
        double d1 = (from.getX() - x) * (from.getX() - x) + (from.getY() - y) * (from.getY() - y);
        double d2 = (to.getX() - x) * (to.getX() - x) + (to.getY() - y) * (to.getY() - y);
        if (d1 > d || d2 > d)
            return false;
        return true;
    }