rotate {autoimage}R Documentation

Rotate coordinates

Description

rotate rotates the coordinates by angle theta around a pivot point.

Usage

rotate(coords, theta, pivot = c(0, 0))

Arguments

coords

A 2-column matrix with the coordinates to be rotated.

theta

The angle (in radians) to rotate the coordinates.

pivot

The pivot point around which the coordinates are rotated. Default is c(0, 0), i.e., the origin.

Examples

# coordinates to rotate
coords <- matrix(rnorm(20), ncol = 2)
# rotate coordinates pi/6 radians around the original
rcoords <- rotate(coords, pi/6)
#compare original coordinates to rotated coordinates
par(mfrow = c(1, 2))
plot(coords)
plot(rcoords)

[Package autoimage version 2.2.3 Index]