Learn R Programming

shotGroups (version 0.6.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')

## S3 method for class 'data.frame':
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')

## S3 method for class 'default':
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
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', 'MOA', 'SMOA', 'milrad'.
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).
  • bbbounding box as returned by getBoundingBox.
  • bbMinminimum-area bounding box as returned by getMinBBox.
  • bbDiaglength of diagonal of bounding box.
  • bbMinDiaglength of diagonal of minimum-area bounding box.
  • minCircminimum enclosing circle as returned by getMinCircle.
  • maxPairDistmaximum pairwise distance between points (center-to-center, = maximum spread).
  • meanDistmean distance to group center.
  • confEllconfidence ellipse with coverage level as returned by getConfEll (robust with doRob=TRUE).
  • CEPRayleigh estimate for the circular error probable CEP with coverage level.
  • targetDefinition of the selected target in original and converted measurement units.
  • ringCountSimulated 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