This function transforms geometric structures by translating, scaling and/or rotating them.
Usage
GeomTrans(x, y = NULL, trans = 0, scale = 1, theta = 0)
Arguments
x, y
vectors containing the coordinates of the vertices of the polygon
, which has to be transformed. The coordinates can be passed in a plotting structure (a list with x and y components), a two-column matrix, .... See xy.coords.
trans
a vector of two values for the translation in x-, resp. y-direction. If only one value is supplied it will be recycled.
scale
a vector of two values for the scaling factor in x-, resp. y-direction. If only one value is supplied it will be recycled.
theta
angle of the rotation in radians starting from 3 o'clock counterclockwise.
Value
The function invisibly returns a list of the coordinates for the transformed shape(s).
# NOT RUN {# let's have a triangleCanvas(main="Rotation")
x <- DrawRegPolygon(nv=3)[[1]]
xt <- GeomTrans(x, trans=c(1, 3), scale=c(2, 2), theta=pi/4)
polygon(xt)
# }