Learn R Programming

secr (version 1.3.0)

rotate: Rotate Points

Description

Rotate a set of points.

Usage

rotate (object, degrees, centrexy = NULL, ...)

Arguments

object
object that may be coerced to a numeric matrix
degrees
clockwise angle of rotation in degrees
centrexy
vector with xy coordinates of rotation centre
...
other arguments (not used)

Value

  • A matrix with the location of each point rotated about the centre.

Details

The first column of object holds the x coordinates of the points and the second holds the y coordinates. If centrexy is NULL then rotation is about (0,0). A generic method, introduced for the class-specific method rotate.traps.

See Also

shift

Examples

Run this code
temp <- matrix(runif (20) * 2 - 1, nc = 2)
temp2 <- rotate(temp, 25)
plot(temp, xlim=c(-1.5,1.5), ylim = c(-1.5,1.5), pch = 16)
points (0,0, pch=2)
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