src/main/java/de/javagl/geom/OrientedBoundingBoxes.java
/**
     * Computes the start point of the edge that determines the
     * direction of one edge of the minimum oriented bounding 
     * box.
     * 
     * @param points The input points
     * @return The alignment point index
     */
Computes the start point of the edge that determines the
direction of one edge of the minimum oriented bounding
box.

@param points The input points
@return The alignment point index
Computes the start point of the edge that determines the direction of one edge of the minimum oriented bounding box . @param points The input points @return The alignment point index
private static int computeAlignmentPointIndex(
        List<Point2D> points)
    {
        double minArea = Double.MAX_VALUE;
        int minAreaIndex = -1;
        for (int i=0; i<points.size(); i++)
        {
            Point2D p0 = points.get(i);
            Point2D p1 = points.get((i+1)%points.size());
            AffineTransform at = computeAlignmentTransform(p0, p1);
            List<Point2D> transformedPoints = Points.transform(at, points);
            Rectangle2D bounds = Points.computeBounds(transformedPoints);
            double area = bounds.getWidth() * bounds.getHeight();
            if (area < minArea)
            {
                minArea = area;
                minAreaIndex = i;
            }
        }
        return minAreaIndex;
    }
private static int computeAlignmentPointIndex ( List < Point2D > points ) { double minArea = Double . MAX_VALUE ; int minAreaIndex = - 1 ; for ( int i = 0 ; i < points . size ( ) ; i ++ ) { Point2D p0 = points . get ( i ) ; Point2D p1 = points . get ( ( i + 1 ) % points . size ( ) ) ; AffineTransform at = computeAlignmentTransform ( p0 , p1 ) ; List < Point2D > transformedPoints = Points . transform ( at , points ) ; Rectangle2D bounds = Points . computeBounds ( transformedPoints ) ; double area = bounds . getWidth ( ) * bounds . getHeight ( ) ; if ( area < minArea ) { minArea = area ; minAreaIndex = i ; } } return minAreaIndex ; }
Computes the start point of the edge that determines the
 direction of one edge of the minimum oriented bounding
 box.
Computes the start point of the edge that determines the direction of one edge of the minimum oriented bounding box .