getBoundingBox {shotGroups} | R Documentation |
Bounding box for a set of 2D-points
Description
Calculates the vertices of the (axis-parallel) bounding box given a set of 2D-coordinates.
Usage
getBoundingBox(xy)
## S3 method for class 'data.frame'
getBoundingBox(xy)
## Default S3 method:
getBoundingBox(xy)
Arguments
xy |
either a numerical (n x 2)-matrix with the (x,y)-coordinates of n points (1 row of coordinates per point), or a data frame with either the variables |
Details
No coordinate transforms are done (unlike in groupLocation
, groupShape
, groupSpread
), i.e., origin is not assumed to be in top-left corner, and points are not taken relative to point of aim.
Value
A list with the following information about the bounding box:
pts |
a numerical 4-vector giving the coordinates |
width |
width of the box. |
height |
height of the box. |
FoM |
figure of merit, i.e., the average side length of the box: ( |
diag |
length of box diagonal. |
See Also
drawBox
,
getMinBBox
,
getMinCircle
Examples
# coordinates given by a suitable data frame
bb <- getBoundingBox(DFsavage)
# draw points and bounding box
plot(point.y ~ point.x, data=DFsavage, asp=1, pch=16)
drawBox(bb, fg='blue', colCtr='blue', pch=4, cex=2)
bb$FoM # figure of merit
# coordinates given by a matrix
## Not run:
xy <- matrix(round(rnorm(20, 100, 15), 1), ncol=2)
getBoundingBox(xy)
## End(Not run)