rotate: Rotate a set of Cartesian points about a centroid.

Description Usage Arguments Details Value Author(s) Examples

View source: R/halftone.R

Description

This function takes a set of points, x and y, and rotates them by a centroid determined by the centroid function.

Usage

1
rotate(x, y, deg = 90, centroid.fun = mean)

Arguments

x

the x coordinates.

y

the y coordinates.

deg

the degree of rotation specified in degrees (converted internally to radians).

centroid.fun

a function applied to x and y that returns a centroid. Defaults to mean. See details.

Details

The centroid function determines the basis by which the coordinates are translated. In general, users will want this to be the mean of x and the mean of y (the default). However, special cases may require different planar orbits or rotations. For example, to set the centroid to the origin (0,0), then set centroid.fun=function(m) m-m

Value

x.rot

new x coordinates.

y.rot

new y coordinates.

Author(s)

Christopher Steven Marcum

Examples

1
2
3
4
x<-rnorm(10)
y<-rnorm(10)
plot(x,y)
points(rotate(x,y,deg=15))

cmarcum/halftoner documentation built on Dec. 2, 2020, 4:24 a.m.