Learn R Programming

Momocs (version 0.2-6)

coo.rotate.center: Rotates a list or matrix of coordinates with any center of symmetry.

Description

coo.rotate.center rotates (counter-clockwise) coo with a theta angle (in radians) and with the center of symmetry specified by center .

Usage

coo.rotate.center(coo, theta, center=c(0, 0))

Arguments

coo
A list or a matrix of coordinates.
theta
numeric. The angle to rotate the shape.
center
The (x; y) coordinates of the center of rotation.

Value

  • A list with x; y components or a a matrix of (x; y)coordinates.

Details

This function simply centers the shape, rotate it, and then "uncenter" it.

See Also

coo.rotate.

Examples

Run this code
data(bot)
coo <- coo.scale(coo.center(bot@coo[[1]]))
coo.plot(coo,  main="The bottle's revolution", ylim=c(-10, 50))
r <- seq(pi/6, 2*pi, pi/6)
cols <- col.summer(12)
for (i in seq(along=r)) {
  coo.draw(coo.rotate.center(coo, r[i], center=c(0, 20)), border=cols[i], col=NA)  
  }
abline(v=0, h=0, col="grey60", lty=2)
points(0, 20, pch=3, col="red")

Run the code above in your browser using DataLab