[R-sig-Geo] minimum area bounding rectangles

Murray Richardson murray_richardson at carleton.ca
Wed Mar 16 00:40:38 CET 2011


Thanks Barry for the great tips.  The MATLAB code will be a huge help - 
should be relatively straightforward to implement in R.

cheers,

Murray

On 15/03/2011 7:20 PM, Barry Rowlingson wrote:
> 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