geom.bbox
drafting: B = geom.bbox (P)
drafting: [B, W, H] = geom.bbox (P)
Axis-aligned bounding box of a set of points.
B = geom.bbox (P) returns the axis-aligned bounding box of
the points given as rows of the -by-2 matrix P, as the 1-by-4
row vector [xmin, ymin, xmax, ymax].
[B, W, H] = geom.bbox (P) additionally returns
the width W and height H of the box.
Unlike most of this namespace, geom.bbox accepts any point set, not
only a polygon: a single point is valid input and yields a box of zero width
and height.
See also: geom.signedarea, geom.centroid, geom.largestrect
Source Code: geom.bbox
The extent of a set of points, and the width and height with it.
t = linspace (0, 2*pi, 181)(1:180)'; P = (30 + 5 * cos (5 * t)) .* [cos(t), sin(t)]; [B, W, H] = geom.bbox (P)
B = -29.870 -33.668 35.000 33.668 W = 64.870 H = 67.336
D = draw.Drawing ().polyline (P, true);
D.Linetype = 'PHANTOM';
D.Colour = 'red';
D = D.polyline ([B(1), B(2); B(3), B(2); B(3), B(4); B(1), B(4)], true);
plot (D);
title ('a profile and the box that bounds it');