title: Algorithm to find the minimum-area-rectangle for given points in order to compute the major and minor axis length
body: <p>I have a set of points (black dots in geographic coordinate value) derived from the convex hull (blue) of a polygon (red). see Figure:<img src="https://i.stack.imgur.com/YYiH9.png" alt="enter image description here"></p>
  
  <pre><code>[(560023.44957588764,6362057.3904932579), 
   (560023.44957588764,6362060.3904932579), 
   (560024.44957588764,6362063.3904932579), 
   (560026.94957588764,6362068.3904932579), 
   (560028.44957588764,6362069.8904932579), 
   (560034.94957588764,6362071.8904932579), 
   (560036.44957588764,6362071.8904932579), 
   (560037.44957588764,6362070.3904932579), 
   (560037.44957588764,6362064.8904932579), 
   (560036.44957588764,6362063.3904932579), 
   (560034.94957588764,6362061.3904932579), 
   (560026.94957588764,6362057.8904932579), 
   (560025.44957588764,6362057.3904932579), 
   (560023.44957588764,6362057.3904932579)]
  </code></pre>
  
  <p>I need to calculate the  the major and minor axis length following these steps (form this <a href="https://gis.stackexchange.com/questions/22895/how-to-find-the-minimum-area-rectangle-for-given-points">post</a> write in R-project and in <a href="http://opencarto.svn.sourceforge.net/viewvc/opencarto/trunk/server/src/main/java/org/opencarto/server/algo/SmallestSurroundingRectangle.java?revision=924&amp;view=markup" rel="noreferrer">Java</a>) or following the <a href="http://cgm.cs.mcgill.ca/~orm/maer.html" rel="noreferrer">this example procedure</a> </p>
  
  <p><img src="https://i.stack.imgur.com/XiPFa.png" alt="enter image description here"></p>
  
  <ol>
  <li>Compute the convex hull of the cloud.</li>
  <li>For each edge of the convex hull:
  2a. compute the edge orientation,
  2b. rotate the convex hull using this orientation in order to compute easily the bounding rectangle area with min/max of x/y of the rotated convex hull,
  2c. Store the orientation corresponding to the minimum area found,</li>
  <li>Return the rectangle corresponding to the minimum area found.</li>
  </ol>
  
  <p>After that we know the The <strong>angle Theta</strong> (represented the orientation of the bounding rectangle relative to the y-axis of the image). The minimum and maximum of <strong>a</strong> and <strong>b</strong> over all boundary points are 
  found:</p>
  
  <ul>
  <li>a(xi,yi) = xi*cos Theta + yi sin Theta </li>
  <li>b(xi,yi) = xi*sin Theta + yi cos Theta</li>
  </ul>
  
  <p>The values (a_max - a_min) and (b_max - b_min) defined the length and width, respectively,
  of the bounding rectangle for a direction Theta.</p>
  
  <p><img src="https://i.stack.imgur.com/AzsJz.png" alt="enter image description here"></p>