# rotation: Rotate a set of point by a certain angle In AEM: Tools to construct Asymmetric eigenvector maps (AEM) spatial variables

## Description

Rotate a set of XY coordinates by an angle (in radians)

## Usage

 `1` ```rotation(xy, angle) ```

## Arguments

 `xy` A 2-columns matrix or data frame containing a set of X and Y coordinates. `angle` Numeric. A scalar giving the angle at which the points should be rotated. The angle is in radians.

## Value

A 2-columns matrix of the same size as `xy` giving the rotated coordinates.

## Warning

This function was not design to handle a large number of rows in `xy`. To use this function for a set of coordinates with more than 1500 entries is not recommended.

## Author(s)

F. Guillaume Blanchet

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```### Create a set of coordinates coords<-cbind(runif(20),runif(20)) ### Create a series of angles rad<-seq(0,pi,l=20) for(i in rad){ coords.rot<-rotation(coords,i) plot(coords.rot) } ### Rotate the coordinates by an angle of 90 degrees coords.90<-rotation(coords,90*pi/180) coords.90 plot(coords,xlim=range(rbind(coords.90,coords)[,1]),ylim=range(rbind(coords.90,coords)[,2]),asp=1) points(coords.90,pch=19) ```

AEM documentation built on May 31, 2017, 3:31 a.m.