GeomTrans | R Documentation |
This function transforms geometric structures by translating, scaling and/or rotating them.
GeomTrans(x, y = NULL, trans = 0, scale = 1, theta = 0)
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 |
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. |
The function invisibly returns a list of the coordinates for the transformed shape(s).
Andri Signorell <andri@signorell.net>
polygon
, DrawRegPolygon
, DrawEllipse
, DrawArc
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.