rot2(sfsmisc)
rot2()所属R语言包:sfsmisc
Rotate Planar Points by Angle
旋转平面的角点
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Rotate planar (xy) points by angle phi (in radians).
旋转角度phi(弧度)的平面(XY)。
用法----------Usage----------
rot2(xy, phi)
参数----------Arguments----------
参数:xy
numeric 2-column matrix, or coercable to one.
数字2列的矩阵,或coercable一个。
参数:phi
numeric scalar, the angle in radians (i.e., phi=pi corresponds to 180 degrees) by which to rotate the points.
数字标量,以弧度为单位的角度(即,phi=pi对应至180度),通过该旋转的点。
值----------Value----------
A two column matrix as xy, containing the rotated points.
一个两列的矩阵xy,旋转点。
(作者)----------Author(s)----------
Martin Maechler, Oct.1994
实例----------Examples----------
## Rotate three points by 60 degrees :[#旋转60度的三点:]
(xy0 <- rbind(c(1,0.5), c(1,1), c(0,1)))
(Txy <- rot2(xy0, phi = 60 * pi/180))
plot(xy0, col = 2, type = "b", asp = 1,
xlim=c(-1,1), ylim=c(0,1.5), main = "rot2(*, pi/3) : 2d rotation by 60掳")
points(Txy, col = 3, type = "b")
O <- rep(0,2); P2 <- rbind(xy0[2,], Txy[2,])
arrows(O,O,P2[,1],P2[,2], col = "dark gray")
xy0 <- .8*rbind(c(1,0), c(.5,.6), c(.7,1), c(1,1), c(.9,.8), c(1,0)) - 0.2
plot(xy0, col= 2, type="b", main= "rot2( <polygon>, pi/4 * 1:7)", asp=1,
xlim=c(-1,1),ylim=c(-1,1), lwd= 2, axes = FALSE, xlab="", ylab="")
abline(h=0, v=0, col="thistle"); text(1.05, -.05, "x"); text(-.05,1.05, "y")
for(phi in pi/4 * 0:7)
do.call("arrows",c(list(0,0),rot2(xy0[2,], phi), length=0.1, col="gray40"))
for(phi in pi/4 * 1:7)
polygon(rot2(xy0, phi = phi), col = 1+phi/(pi/4), border=2, type = "b")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|