Description Usage Arguments Value References See Also Examples
Rotate coordinates clockwise around a pivot point.
1 | coordturn(pts, pvt, rot)
|
pts |
A numeric matrix with two columns of x and y coordinates to be rotated. |
pvt |
A numeric vector of length 2, the x and y coordinates of the pivot point
around which |
rot |
A numeric scalar indicating the amount of clockwise rotation, in radians. |
A numeric matrix with same dimension as pts
with the rotated
x and y coordinates.
Modification of code posted by Sage on 3 March 2011 on the website benn.org [link].
coordplot
, coordmove
,
coordflip
, coordtri
.
1 2 3 4 5 6 7 8 9 10 11 12 | # starting coordinates
test <- matrix(c(0, 4, 1, 0, 2, 3), ncol=2,
dimnames=list(LETTERS[1:3], NULL))
coordplot(test)
# rotate the coordinates clockwise 45 degrees
# around the first point (the origin)
rottest <- coordturn(test, test[1, ], rot=pi/4)
coordplot(rottest)
# rotate the coordinates counterclockwise 45 degrees
# around the first point (the origin)
rottest <- coordturn(test, test[1, ], rot=-pi/4)
coordplot(rottest)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.