GeomTrans.Rd
This function transforms geometric structures by translating, scaling and/or rotating them.
GeomTrans(x, y = NULL, trans = 0, scale = 1, theta = 0)
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
.
a vector of two values for the translation in x-, resp. y-direction. If only one value is supplied it will be recycled.
a vector of two values for the scaling factor in x-, resp. y-direction. If only one value is supplied it will be recycled.
angle of the rotation in radians starting from 3 o'clock counterclockwise.
The function invisibly returns a list of the coordinates for the transformed shape(s).
# let's have a triangle
Canvas(main="Rotation")
x <- DrawRegPolygon(nv=3)[[1]]
xt <- GeomTrans(x, trans=c(1, 3), scale=c(2, 2), theta=pi/4)
polygon(xt)