inside.owin(spatstat)
inside.owin()所属R语言包:spatstat
Test Whether Points Are Inside A Window
测试无论点都在一个窗口
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Test whether points lie inside or outside a given window.
测试,是否点位于内部或外部给定的窗口。
用法----------Usage----------
inside.owin(x, y, w)
参数----------Arguments----------
参数:x
Vector of x coordinates of points to be tested. (Alternatively, a point pattern object providing both x and y coordinates.)
向量的x要测试的点的坐标。另外,点的模式对象提供两个x和y坐标。
参数:y
Vector of y coordinates of points to be tested.
向量的y要测试的点的坐标。
参数:w
A window. This should be an object of class owin, or can be given in any format acceptable to as.owin().
一个窗口。这应该是一个对象的类owin,或可以得到可接受的任何格式as.owin()。
Details
详细信息----------Details----------
This function tests whether each of the points (x[i],y[i]) lies inside or outside the window w and returns TRUE if it is inside.
此函数的每一个点的测试是否(x[i],y[i])在于窗口的内部或外部w,并返回TRUE如果它里面。
The boundary of the window is treated as being inside.
被视为是内部边界的窗口。
If w is of type "rectangle" or "polygonal", the algorithm uses analytic geometry (the discrete Stokes theorem). Computation time is linear in the number of points and (for polygonal windows) in the number of vertices of the boundary polygon. Boundary cases are correct to single precision accuracy.
如果w是类型"rectangle"或"polygonal",该算法采用解析几何(离散型Stokes定理)。的点的数量和(多边形窗口)在边界多边形顶点的数目,计算时间是线性的。单精度边界的情况下是正确的。
If w is of type "mask" then the pixel closest to (x[i],y[i]) is tested. The results may be incorrect for points lying within one pixel diameter of the window boundary.
如果w是类型"mask"然后最接近的像素(x[i],y[i])测试。结果可能是不正确的点直径的一个像素的窗口边界内。
Normally x and y must be numeric vectors of equal length (length zero is allowed) containing the coordinates of points. Alternatively x can be a point pattern (object of class "ppp") while y is missing; then the coordinates of the point pattern are extracted.
通常x和y必须是数字向量相等的长度(长度为零的是允许的),其中包含的点的坐标。或者x可以是一个点模式(对象的类"ppp"),而y失踪,然后提取的坐标点模式。
值----------Value----------
Logical vector whose ith entry is TRUE if the corresponding point (x[i],y[i]) is inside w.
逻辑向量,它的i个条目是TRUE,如果相应的的(x[i],y[i])点内w。
(作者)----------Author(s)----------
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>
参见----------See Also----------
owin.object, as.owin
owin.object,as.owin
实例----------Examples----------
# hexagonal window[六角窗]
k <- 6
theta <- 2 * pi * (0 k-1))/k
co <- cos(theta)
si <- sin(theta)
mas <- owin(c(-1,1), c(-1,1), poly=list(x=co, y=si))
## Not run: [#不运行:]
plot(mas)
## End(Not run)[#(不执行)]
# random points in rectangle[随机点的矩形]
x <- runif(30,min=-1, max=1)
y <- runif(30,min=-1, max=1)
ok <- inside.owin(x, y, mas)
## Not run: [#不运行:]
points(x[ok], y[ok])
points(x[!ok], y[!ok], pch="x")
## End(Not run) [#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|