R: Search for the enclosing Delaunay convex hull

tsearch {geometry} | R Documentation

## 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)

### Arguments

`x` | X-coordinates of triangluation points
`y` | Y-coordinates of triangluation 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.

### 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 code(xi, yi).

### Note

Based on the Octave function Copyright (C) 2007-2012 David Bateman.

### Author(s)

David Sterratt

### See Also

tsearchn, delaunayn

[Package geometry version 0.3-6 Index]