transformations(secr)
transformations()所属R语言包:secr
Transform Point Array
转换点阵列
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Flip (reflect), rotate or slide (translate) an array of points. Methods are provided for "traps" objects that ensure other attributes are retained. The methods may be used with rbind.traps to create complex geometries.
翻转(反映),旋转或滑动(翻译)一个点的数组。方法提供了“陷阱”对象,以确保其他属性保持不变。与rbind.traps的方法可用于创建复杂的几何形状。
用法----------Usage----------
flip (object, lr = F, tb = F, ...)
rotate (object, degrees, centrexy = NULL, ...)
shift (object, shiftxy, ...)
## S3 method for class 'traps'
flip(object, lr = F, tb = F, ...)
## S3 method for class 'traps'
rotate(object, degrees, centrexy = NULL, ...)
## S3 method for class 'traps'
shift(object, shiftxy, ...)
## S3 method for class 'popn'
flip(object, lr = F, tb = F, ...)
## S3 method for class 'popn'
rotate(object, degrees, centrexy = NULL, ...)
## S3 method for class 'popn'
shift(object, shiftxy, ...)
参数----------Arguments----------
参数:object
a 2-column matrix or object that can be coerced to a matrix
2列的矩阵或对象可以强制转换为矩阵
参数:lr
either logical for whether array should be flipped left-right, or numeric value for x-coordinate of axis about which it should be flipped left-right
用于是否阵列应当翻转左 - 右,或对于x坐标轴的数值,它应当翻转左右的任一逻辑
参数:tb
either logical for whether array should be flipped top-bottom, or numeric value for y-coordinate of axis about which it should be flipped top-bottom
任一逻辑是否阵列应当翻转顶部底部,或数字值,y坐标轴,它应当翻转顶底
参数:degrees
clockwise angle of rotation in degrees
顺时针方向的旋转角以度
参数:centrexy
vector with xy coordinates of rotation centre
使用XY坐标矢量的旋转中心
参数:shiftxy
vector of x and y displacements
矢量的x和y的位移
参数:...
other arguments (not used)
其他参数(未使用)
Details
详细信息----------Details----------
flip reflects points about a vertical or horizontal axis. Logical values for lr or tb indicate that points should be flipped about the mean on the relevant axis. Numeric values indicate the particular axis value(s) about which points should be flipped. The default arguments result in no change.
flip反映有关的垂直轴或水平轴的点。逻辑值lr或tb的点应可翻转的平均相关的轴。数值表示特定的轴值(S),这点应翻转。默认参数没有变化。
shift shifts the location of each point by the desired amount on each axis.
shift所需的量在每个轴上的各点的位置移位。
rotate rotates the array about a designated point. If centrexy is NULL then rotation is about (0,0) (rotate.default), the array centre (rotate.traps), or the centre of the bounding box (rotate.popn).
rotate指定点左右旋转阵列。如果centrexy是NULL,然后旋转大约是(0,0),(rotate.default),阵列中心(rotate.traps),或包围盒的中心(rotate.popn) 。
值----------Value----------
A matrix or object of class "traps" or "popn" with the coordinates of each point transformed as requested.
类“陷阱或POPN”的每个点的坐标变换矩阵或对象的要求。
参见----------See Also----------
traps, popn
traps,popn
实例----------Examples----------
temp <- matrix(runif (20) * 2 - 1, nc = 2)
## flip[#翻转]
temp2 <- flip(temp, lr = 1)
plot(temp, xlim=c(-1.5,4), ylim = c(-1.5,1.5), pch = 16)
points (temp2, pch = 1)
arrows (temp[,1], temp[,2], temp2[,1], temp2[,2], length = 0.1)
abline(v = 1, lty = 2)
## rotate[#旋转]
temp2 <- rotate(temp, 25)
plot(temp, xlim=c(-1.5,1.5), ylim = c(-1.5,1.5), pch = 16)
points (0,0, pch=2)
points (temp2, pch = 1)
arrows (temp[,1], temp[,2], temp2[,1], temp2[,2], length = 0.1)
## shiftxy[#shiftxy]
temp2 <- shift(temp, c(0.1, 0.1))
plot(temp, xlim=c(-1.5,1.5), ylim = c(-1.5,1.5), pch = 16)
points (0,0, pch=2)
points (temp2, pch = 1)
arrows (temp[,1], temp[,2], temp2[,1], temp2[,2], length = 0.1)
## flip.traps[#flip.traps]
oldpar <- par(mfrow=c(1,2), xpd = TRUE)
traps1 <- make.grid(nx = 8, ny = 6, ID = "numxb")
traps2 <- flip (traps1, lr = TRUE)
plot(traps1, border = 5, label = TRUE, offset = 7, gridl = FALSE)
plot(traps2, border = 5, label = TRUE, offset = 7, gridl = FALSE)
par(oldpar)
## rotate.traps[#rotate.traps]
hollow1 <- make.grid(nx = 8, ny = 8, hollow = TRUE)
nested <- rbind (hollow1, rotate(hollow1, 45, c(70, 70)))
plot(nested, gridlines = FALSE)
## shift.traps[#shift.traps]
hollow1 <- make.grid(nx = 8, ny = 8, hollow = TRUE)
hollow2 <- shift(make.grid(nx = 6, ny = 6, hollow = TRUE), c(20, 20))
nested <- rbind (hollow1, hollow2)
plot(nested, gridlines = FALSE, label = TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|