rotate: Rotate coordinates

Description Usage Arguments Examples

View source: R/rotate.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
# 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)

autoimage documentation built on March 16, 2021, 5:07 p.m.