DescTools (version 0.99.14)

Rotate: Rotate a Geometric Structure

Description

Rotate a geometric structure by an angle theta around a centerpoint xy.

Usage

Rotate(x, y, mx = 0, my = 0, theta = pi/3)

Arguments

x, y
a vector of xy-coordinates of the geometric structure, which has to be rotated
mx,my
xy-coordinates of the center of the rotation.
theta
angle of the rotation

Value

  • The function invisibly returns a list of the coordinates for the rotated shape(s).

See Also

polygon, DrawRegPolygon, DrawEllipse, DrawArc, DrawAnnulus

Examples

Run this code
# let's have a triangle
Canvas(main="Rotation")
x <- DrawRegPolygon(nv=3)[[1]]

# and rotate
sapply( (0:3) * pi/6, function(theta) {
  xy <- Rotate( x=x$x, y=x$y, theta=theta )
  polygon(xy$x, xy$y, col=SetAlpha("blue", 0.2))
} )

abline(v=0,h=0)

Run the code above in your browser using DataCamp Workspace