[R-sig-Geo] minimum area bounding rectangles

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Mar 16 00:20:12 CET 2011


On Tue, Mar 15, 2011 at 4:37 PM, Murray Richardson
<murray_richardson at carleton.ca> wrote:
> Hi R users,
>
> I would like to compute minimum area bounding rectangles for polygon
> features to extract short and long axes and azimuths of the long axes.  Is
> this possible in R? I have not been able to find a way (yet).
>
> Thanks in advance for any help.

 Do you mean you've not found code for it or not found and implemented
an algorithm for it?

 There's a proof that the minimum area bounding rectangle of a convex
polygon will have one side along a side of the polygon, so the
algorithm involves N rotations of the polygon and computation of the
area of the axis-aligned bounding box after rotation. Choose the
rotation that minimises this.

 In R, chull will get you the convex hull, atan2 will get you the
angles, and sines and cosines will get you a rotation matrix. There's
some matlab code here:

http://www.mathworks.com/matlabcentral/fileexchange/13624-minimal-bounding-rectangle

 which might be useful.

Barry



More information about the R-sig-Geo mailing list