public void setLine(Line line) {
        if (line.getPoint0() == this || line.getPoint1() == this) {
            haveLine = true;
            this.line = line;
            if (this == line.getPoint0()) {
                if (line.getPoint0().getX() == line.getPoint1().getX()) { //Для вертикальных прямых
                    isLeft = line.getPoint0().getY() < line.getPoint1().getY();
                } else {
                    isLeft = line.getPoint0().getX() < line.getPoint1().getX();
                }
            } else {
                if (line.getPoint0().getX() == line.getPoint1().getX()) {
                    isLeft = line.getPoint0().getY() > line.getPoint1().getY();
                } else {
                    isLeft = line.getPoint0().getX() > line.getPoint1().getX();
                }
            }

        } else {
            throw new IllegalArgumentException("Точка не лежит на концах отрезка");
        }
    }