Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tsearch

Search for the enclosing Delaunay convex hull


Description

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.

Usage

tsearch(x, y, t, xi, yi, bary = FALSE, method = "quadtree")

Arguments

x

X-coordinates of triangulation points

y

Y-coordinates of triangulation points

t

Triangulation, e.g. produced by t <- delaunayn(cbind(x, y))

xi

X-coordinates of points to test

yi

Y-coordinates of points to test

bary

If TRUE return barycentric coordinates as well as index of triangle.

method

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.

Value

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:

list("idx")

the index in t containing the points (xi, yi)

list("p")

a 3-column matrix containing the barycentric coordinates with respect to the enclosing triangle of each point (xi, yi).

Note

The original Octave function is Copyright (C) 2007-2012 David Bateman

Author(s)

Jean-Romain Roussel (Quadtree algorithm), David Sterratt (Octave-based implementation)

See Also


geometry

Mesh Generation and Surface Tessellation

v0.4.5
GPL (>= 3)
Authors
Jean-Romain Roussel [cph, ctb] (wrote tsearch function with QuadTrees), C. B. Barber [cph], Kai Habel [cph, aut], Raoul Grasman [cph, aut], Robert B. Gramacy [cph, aut], Pavlo Mozharovskyi [cph, aut], David C. Sterratt [cph, aut, cre] (<https://orcid.org/0000-0001-9092-9099>)
Initial release
2019-12-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.