/// <summary>
 /// Gets the best oriented bounding rectangle enclosing a convex hull or polygon according to a user-defined
 /// criterion. You can call <c>ConvexHull.Compute(points);</c> to create a convex hull.
 /// </summary>
 /// <remarks>
 /// The convex hull must be given with counterclockwise-ordered vertices in a right-handed coordinate system
 /// (y-axis pointing upwards) and clockwise-ordered vertices in a left-handed coordinate system (y-axis
 /// pointing downwards, as is the case for screen coordinates)<br/>
 /// <br/>
 /// The returned rectangle is always aligned with at least one edge of the convex hull. For the
 /// minimum aera and minimum width this will return the optimal rectangle. For other criteria, the rectangle
 /// might be sub-optimal.</remarks>
 /// <param name="convexHull">A convex hull or polynome.</param>
 /// <param name="isBetter">Delegate telling whether a rectangle is better than a reference rectangle.</param>
 /// <returns>The best oriented bounding rectangle.</returns>
 public static OrientedRectangle OptimalFromConvexHull(IList <Vector2> convexHull, CompareRectPredicate isBetter)
 {
     if (convexHull.Count == 0)
     {
         return(default);
        /// <summary>
        /// Gets the best oriented bounding rectangle enclosing an arbitrary set of points according to a user-defined
        /// criterion.
        /// </summary>
        /// <remarks>The returned rectangle is always aligned with at least one edge of the convex hull of the points.
        /// For the minimum aera and minimum width this will return the optimal rectangle. For other criteria, the
        /// rectangle might be sub-optimal.<br/><br/>
        /// This calls <c>ConvexHull.Compute(points);</c></remarks>
        /// <param name="points">Arbitrary set of points.</param>
        /// <param name="isBetter">Delegate telling whether a rectangle is better than a reference rectangle.</param>
        /// <returns>The best oriented bounding rectangle.</returns>
        public static OrientedRectangle OptimalFromPoints(ICollection <Vector2> points, CompareRectPredicate isBetter)
        {
            var convexHull = QuickHull.Compute(points);

            return(OptimalFromConvexHull(convexHull, isBetter));
        }