Learn R Programming

shotGroups (version 0.7.1)

drawGroup: 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, xyTopLeft=TRUE, bb = FALSE, bbMin = FALSE, bbDiag = FALSE, minCirc = FALSE, maxSpread = FALSE, meanDist = FALSE, confEll = FALSE, CEP = FALSE, ringID = FALSE, doRob = FALSE, level = 0.95, scaled = TRUE, caliber = 9, dstTarget = 100, conversion = 'm2cm', unit = 'unit', alpha = 0.5, target = 'ISSF_100m')
"drawGroup"(xy, xyTopLeft=TRUE, bb = FALSE, bbMin = FALSE, bbDiag = FALSE, minCirc = FALSE, maxSpread = FALSE, meanDist = FALSE, confEll = FALSE, CEP = FALSE, ringID = FALSE, doRob = FALSE, level = 0.95, scaled = TRUE, caliber = 9, dstTarget = 100, conversion = 'm2cm', unit = 'unit', alpha = 0.5, target = 'ISSF_100m')
"drawGroup"(xy, xyTopLeft=TRUE, bb = FALSE, bbMin = FALSE, bbDiag = FALSE, minCirc = FALSE, maxSpread = FALSE, meanDist = FALSE, confEll = FALSE, CEP = FALSE, ringID = FALSE, doRob = FALSE, level = 0.95, scaled = TRUE, caliber = 9, dstTarget = 100, conversion = 'm2cm', unit = 'unit', alpha = 0.5, target = 'ISSF_100m')

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).
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?
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?
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. See getMOA.
conversion
how to convert the measurement unit for distance to target to that of the (x,y)-coordinates - used in MOA calculation. 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 indicating the target type to be drawn in the scatterplot. Set to NA to omit target background. 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.
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, getMaxPairDist, getDistToCtr, getConfEll, drawBox, drawBox2, drawCircle, drawEllipse, targets, drawTarget, simRingCount, covMcd

Examples

Run this code
# 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),
          conversion="yd2in", caliber=7.62, dstTarget=100, target=NA)

Run the code above in your browser using DataLab