@Override
    public int compareTo(Object o) {
        Point2D point2D = (Point2D) o;
        if (compareModel == CompareModel.X) {
            if (x > point2D.x) {
                return 1;
            } else if (x < point2D.x) {
                return -1;
            }
        } else if (compareModel == CompareModel.Y) {
            if (y > point2D.y) {
                return 1;
            } else if (y < point2D.y) {
                return -1;
            }
        } else if (compareModel == CompareModel.PolarAngle) {
            if (getPolarAngle() > point2D.getPolarAngle()) {
                return 1;
            } else if (getPolarAngle() < point2D.getPolarAngle()) {
                return -1;
            }
        }
        return 0;
    }