Learn R Programming

secr (version 4.6.10)

make.tri: Build Detector Array on Triangular or Hexagonal Grid

Description

Construct an array of detectors on a triangular grid and optionally select a hexagonal subset of detectors.

Usage

make.tri (nx = 10, ny = 12, spacing = 20, detector = "multi",
    originxy = c(0,0))

clip.hex (traps, side = 20, centre = c(50, 60*cos(pi/6)), fuzz = 1e-3, ID = "num", ...)

Value

An object of class traps comprising a data frame of x- and y-coordinates, the detector type ("single", "multi", or "proximity" etc.), and possibly other attributes.

Arguments

nx

number of columns of detectors

ny

number of rows of detectors

spacing

distance between detectors (x and y directions)

detector

character value for detector type - "single", "multi" etc.

originxy

vector origin for x-y coordinates

traps

traps object

side

length of hexagon side

centre

x-y coordinates of hexagon centre

fuzz

floating point fuzz value

ID

character string to control row names

...

other parameters passed to subset.traps (not used)

Details

make.tri generates coordinates for nx.ny traps at separations spacing. The bottom-left (southwest) corner is at originxy. Identifiers are numeric. See make.grid for further explanation.

clip.hex clips a grid of detectors, retaining only those within a bounding hexagon. Detectors are re-labelled according to ID as follows:

IDEffect
NULLno change
numnumeric sequence
alphaletter for`shell'; number within shell

See Also

make.grid, detector

Examples

Run this code

tri.grid <- make.tri(spacing = 10)
plot(tri.grid, border = 5)

hex <- clip.hex(tri.grid, side = 30, ID = "alpha")
plot (hex, add = TRUE, detpar = list(pch = 16, cex = 1.4),
    label = TRUE, offset = 2.5 )

Run the code above in your browser using DataLab