class AreaOfInterest extends GraphicalContext<BorderPane> {

    static Double[] calculateConvexHull(final Point2D[] points) {
        final int numberOfPoints = points.length;
        final ArrayList<Double> convexHullPoints = new ArrayList<>();
        final Vector<Point2D> hull = new Vector<>();

        // Finding the index of the lowest X value, or left-most point, in all points.
        int lowestValueIndex = 0;
        for (int i = 1; i < numberOfPoints; i++) {
            if (points[i].getX() < points[lowestValueIndex].getX()) {
                lowestValueIndex = i;
            }
        }

        int point = lowestValueIndex, q;
        do {
            hull.add(points[point]);
            q = (point + 1) % numberOfPoints;
            for (int i = 0; i < numberOfPoints; i++) {
                if (orientation(points[point], points[i], points[q]) < 0) { // Checking if the points are convex.
                    q = i;
                }
            }
            point = q;
        } while (point != lowestValueIndex);

        for (final Point2D temp : hull) {
            convexHullPoints.add(temp.getX());
            convexHullPoints.add(temp.getY());
        }

        Double[] hullPointsArray = new Double[convexHullPoints.size()];
        convexHullPoints.toArray(hullPointsArray);

        return hullPointsArray;
    }

    public  AreaOfInterest(final GazePlay gazePlay, final Stats stats);

}