Learn R Programming

secr (version 1.3.0)

flip: Flip Points

Description

Flip an array of points about a vertical or horizontal axis.

Usage

flip (object, lr = F, tb = F, ...)

Arguments

object
a 2-column matrix or object that can be coerced to a matrix
lr
either logical for whether array should be flipped left-right, or numeric value for x-coordinate of axis about which it should be flipped left-right
tb
either logical for whether array should be flipped top-bottom, or numeric value for y-coordinate of axis about which it should be flipped top-bottom
...
other arguments (not used)

Value

  • A matrix with the coordinates of each point reflected about the desired axis or axes.

Details

Logical values for lr or tb indicate that points should be flipped about the mean on the relevant axis. Numeric values indicate the particular axis value(s) about which points should be flipped. The default arguments result in no change. This is a generic function. A method is provided for traps objects.

See Also

traps, rotate.traps

Examples

Run this code
temp <- matrix(runif (20) * 2 - 1, nc = 2)
temp2 <- flip(temp, lr = 1)
plot(temp, xlim=c(-1.5,4), ylim = c(-1.5,1.5), pch = 16)
points (temp2, pch = 1)
arrows (temp[,1], temp[,2], temp2[,1], temp2[,2], length = 0.1)

Run the code above in your browser using DataLab