drawGroup: Draw a group of bullet holes with additional measures

View source: R/drawGroup.R

drawGroupR Documentation

Draw a group of bullet holes with additional measures

Description

Draws a group with scaled bullet holes on a target background. Spread measures can be selected individually.

Usage

drawGroup(xy, center = FALSE, xyTopLeft = TRUE,
          bb = FALSE, bbMin = FALSE, bbDiag = FALSE,
          minCirc = FALSE, minEll = FALSE, maxSpread = FALSE,
          meanDist = FALSE, confEll = FALSE,
          CEP = FALSE, ringID = FALSE, valueID = TRUE, doRob = FALSE,
          level = 0.95, scaled = TRUE, caliber = 9, dstTarget, conversion,
          unit = 'unit', alpha = 0.5, target)

## S3 method for class 'data.frame'
drawGroup(xy, center = FALSE, xyTopLeft = TRUE,
          bb = FALSE, bbMin = FALSE, bbDiag = FALSE,
          minCirc = FALSE, minEll = FALSE,
          maxSpread = FALSE, meanDist = FALSE, confEll = FALSE,
          CEP = FALSE, ringID = FALSE, valueID = TRUE, doRob = FALSE,
          level = 0.95, scaled = TRUE, caliber = 9, dstTarget, conversion,
          unit = 'unit', alpha = 0.5, target)

## Default S3 method:
drawGroup(xy, center = FALSE, xyTopLeft = TRUE,
          bb = FALSE, bbMin = FALSE, bbDiag = FALSE,
          minCirc = FALSE, minEll = FALSE,
          maxSpread = FALSE, meanDist = FALSE, confEll = FALSE,
          CEP = FALSE, ringID = FALSE, valueID = TRUE, doRob = FALSE,
          level = 0.95, scaled = TRUE, caliber = 9, dstTarget, conversion,
          unit = 'unit', alpha = 0.5, target)

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 x, y or point.x, point.y as well as aim.x, aim.y giving the point of aim. If missing, point of aim is assumed to be in (0,0).

center

logical: center groups to mean (0,0) first? If variable series does not exist, all shots are treated as belonging to the same group. Only available in method drawGroup.data.frame().

xyTopLeft

logical: is the origin of the absolute coordinate system in the top-left corner? This is the default for data exported by OnTarget PC/TDS. If an (n x 2)-matrix is supplied for xy, point of aim is assumed to be in (0,0).

bb

logical: draw bounding box?

bbMin

logical: draw minimum-area bounding box?

bbDiag

logical: draw bounding box diagonal?

minCirc

logical: draw minimum enclosing circle?

minEll

logical: draw minimum enclosing ellipse?

maxSpread

logical: draw maximum spread?

meanDist

logical: draw circle with mean distance to group center?

confEll

logical: draw confidence ellipse with coverage level?

CEP

draw estimate of CEP circle with coverage level? Either logical or a string defining the CEP type. See getCEP.

ringID

logical: identify and display the ring count for each shot?

valueID

logical: display numerical values of calculated measures in the diagram?

doRob

logical: use robust estimation of group center and confidence ellipse?

scaled

logical: draw bullet holes to scale?

caliber

a numerical value indicating the bullet diameter in mm.

level

a numerical vector giving the coverages of the confidence ellipses and CEPs.

dstTarget

a numerical value giving the distance to the target - used in MOA calculation. Acts as override if variable distance is already included in xy. See getMOA.

conversion

how to convert the measurement unit for distance to target to that of the (x,y)-coordinates in MOA calculation. Acts as override if variables dist.unit and point.unit are already included in xy. Example 'm2cm'. See getMOA.

unit

Measurement unit for the diagram. Defalt 'unit' indicates that the measurement unit given in conversion should be used. Possible values are 'unit', 'm', 'cm', 'mm', 'yd', 'ft', 'in', 'deg', 'MOA', 'SMOA', 'rad', 'mrad', 'mil'.

alpha

a numerical value in [0,1] which controls the alpha blending for simulated transparency used to draw the bullet holes

target

a character string like 'ISSF_100m' indicating the target type to be drawn in the scatterplot. See targets.

Value

Invisibly returns a list with the following components, all converted to unit (if they were requested):

xy

(x,y)-coordinates converted to unit.

ctr

(x,y)-offset of group center relative to point of aim in unit (robust with doRob=TRUE).

bb

bounding box as returned by getBoundingBox.

bbMin

minimum-area bounding box as returned by getMinBBox.

bbDiag

length of diagonal of bounding box.

bbMinDiag

length of diagonal of minimum-area bounding box.

minCirc

minimum enclosing circle as returned by getMinCircle.

minEll

minimum enclosing ellipse as returned by getMinEllipse.

maxPairDist

maximum pairwise distance between points (center-to-center, = maximum spread).

meanDist

mean distance to group center.

confEll

confidence ellipse with coverage level as returned by getConfEll (robust with doRob=TRUE).

CEP

Rayleigh estimate for the circular error probable CEP with coverage level.

target

Definition of the selected target in original and converted measurement units.

ringCount

Simulated and maximum ring count as returned by simRingCount.

See Also

getBoundingBox, getMinBBox, getMinCircle, getMinEllipse, getMaxPairDist, getDistToCtr, getConfEll, drawBox, drawBox2, drawCircle, drawEllipse, targets, drawTarget, simRingCount, covMcd

Examples

# draw group in MOA
dg <- drawGroup(DFcciHV, xyTopLeft=TRUE, bb=TRUE, minCirc=TRUE,
                confEll=TRUE, maxSpread=TRUE, caliber=5.56, unit='MOA',
                dstTarget=100, conversion='yd2in', target='BDS9')

# mininum enclosing circle in MOA
dg$minCirc

# show Grubbs-Patnaik CEP estimator for mulitple levels
drawGroup(DF300BLKhl, CEP="GrubbsPatnaik", level=c(0.5, 0.9, 0.95),
          dstTarget=100, conversion="yd2in", caliber=7.62)

shotGroups documentation built on Sept. 18, 2022, 1:08 a.m.