MINIMUMCALIPERDIAMETER Minimum caliper diameter of a set of points. WIDTH = minimumCaliperDiameter(POINTS) Computes the minimum width of a set of points. As polygons and polylines are represented as point lists, this function works also for polygons and polylines. [WIDTH THETA] = minimumCaliperDiameter(POINTS) Also returns the direction of minimum width. The direction corresponds to the horizontal angle of the edge that minimizes the width. THETA is given in radians, between 0 and PI. Example % Compute minimal caliper diameter, and check coords of rotated points % have expected extent points = randn(30, 2); [width theta] = minimumCaliperDiameter(points); points2 = transformPoint(points, createRotation(-theta)); diff = max(points2) - min(points2); abs(width - diff(2)) < 1e-10 ans = 1 References Algorithms use rotating caliper. Implementation was based on that of Wikipedia: http://en.wikipedia.org/wiki/Rotating_calipers See also polygons2d, convexHull, orientedBox
Package: matgeom