On Tue, Mar 15, 2011 at 4:37 PM, Murray Richardson <murray_richard...@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 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo