rectLookup | R Documentation |
Determine which objects, stored in a SearchTrees indexing object, fall within a given rectangle in two-dimensional space.
rectLookup(tree, ptOne, ptTwo, xlims, ylims)
tree |
SearchTree. A SearchTree object to perform the lookup on. |
ptOne |
Numeric. A numeric of length two indicating x and y values for one corner of the rectangle. |
ptTwo |
Numeric. A numeric of length two indicating x and y values for the
corner of the rectangle opposite to |
xlims |
Numeric. A numeric vector indicating the minimum and maximum x value
for the rectangle. Overrides |
ylims |
Numeric. A numeric vector indicating the minimum and maximum y value for
the rectangle. Overrides |
In the case of lookup for rectangular objects, any rectangle which overlaps the query rectangle will be returned.
A numeric vector indicating the indicies of the object (in the order they were in when the SearchTree object was created) which fall (at least partially) within the rectangular query.
Gabriel Becker
QuadTree
knnLookup
x = rnorm(100) y = rnorm(100) x2 = x + runif(100, .5, 2) y2 = y + runif(100, .5, 2) dat2 = cbind(x, y, x2, y2) tree2 = createTree(dat2, dataType="rect", columns= 1:4) inrect = rectLookup(tree2, xlim = c(0,1), ylim=c(0, 1)) col = rgb(0, 1, 0, alpha=.5) plot(x, y2, col="white") rect(x[inrect], y[inrect], x2[inrect], y2[inrect], col=col) rect(0, 0, 1, 1, col="blue", lwd=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.