For t <- delaunay(cbind(x, y))
, where (x, y)
is a 2D set of
points, tsearch(x, y, t, xi, yi)
finds the index in t
containing the points (xi, yi)
. For points outside the convex hull
the index is NA
.
tsearch(x, y, t, xi, yi, bary = FALSE, method = "quadtree")
If bary
is FALSE
, the index in t
containing the points
(xi, yi)
. For points outside the convex hull the index is NA
.
If bary
is TRUE
, a list containing:
the index in t
containing the points (xi, yi)
a 3-column matrix containing the barycentric coordinates with
respect to the enclosing triangle of each point (xi, yi)
.
X-coordinates of triangulation points
Y-coordinates of triangulation points
Triangulation, e.g. produced by t <-
delaunayn(cbind(x, y))
X-coordinates of points to test
Y-coordinates of points to test
If TRUE
return barycentric coordinates as well
as index of triangle.
One of "quadtree"
or "orig"
. The
Quadtree algorithm is much faster and new from version
0.4.0. The orig
option uses the tsearch algorithm adapted
from Octave code. Its use is deprecated and it may be removed
from a future version of the package.
Jean-Romain Roussel (Quadtree algorithm), David Sterratt (Octave-based implementation)
tsearchn
, delaunayn