public BruteCollinearPoints(Point[] points) {
        if (checkDuplicatePoints(points)) {
            throw new IllegalArgumentException("Cannot have duplicate points.");
        }

        int n = points.length;
        segmentId = 0;
        segmentObjects = new LineSegment[n];

        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                for (int k = j + 1; k < n; k++) {
                    for (int l = k + 1; l < n; l++) {
                        Point p = points[i];
                        Point q = points[j];
                        Point r = points[k];
                        Point s = points[l];
                        if (p.slopeTo(q) == p.slopeTo(r) && p.slopeTo(r) == p.slopeTo(s)) {
                            Point[] tuple = new Point[] {p, q, r, s};
                            Arrays.sort(tuple);
                            segmentObjects[segmentId] = new LineSegment(tuple[0], tuple[3]);
                            segmentId++;
                            if (segmentId == segmentObjects.length) {
                                resize(segmentId * 2);
                            }
                        }
                    }
                }
            }
        }

        segments = new LineSegment[segmentId];
        for (int i = 0; i < segmentId; i++) {
            segments[i] = (LineSegment) segmentObjects[i];
        }
    }