# tri.find

From tripack v1.0-1

##### Locate a point in a triangulation

This subroutine locates a point P=(`x`

,`y`

) relative to a triangulation
created by `tri.mesh`

. If P is
contained in a triangle, the three vertex indexes are
returned. Otherwise, the indexes of the rightmost and
leftmost visible boundary nodes are returned.

##### Usage

`tri.find(tri.obj,x,y)`

##### Arguments

- tri.obj
- an triangulation object
- x
- x-coordinate of the point
- y
- y-coordinate of the point

##### Value

- A list with elements
`i1`

,`i2`

,code{i3} containing nodal indexes, in counterclockwise order, of the vertices of a triangle containing P=(`x`

,`y`

), or, if P is not contained in the convex hull of the nodes,`i1`

indexes the rightmost visible boundary node,`i2`

indexes the leftmost visible boundary node, and`i3`

= 0. Rightmost and leftmost are defined from the perspective of P, and a pair of points are visible from each other if and only if the line segment joining them intersects no triangulation arc. If P and all of the nodes lie on a common line, then`i1`

=`i2`

=`i3`

= 0 on output.

##### References

R. J. Renka (1996). Algorithm 751: TRIPACK: a constrained
two-dimensional {Delaunay} triangulation package.
ACM Transactions on Mathematical Software.
**22**, 1-8.

##### See Also

`tri`

, `print.tri`

, `plot.tri`

,
`summary.tri`

, `triangles`

,
`convex.hull`

##### Examples

```
data(tritest)
tritest.tr<-tri.mesh(tritest$x,tritest$y)
plot(tritest.tr)
pnt<-list(x=0.3,y=0.4)
triangle.with.pnt<-tri.find(tritest.tr,pnt$x,pnt$y)
attach(triangle.with.pnt)
lines(tritest$x[c(i1,i2,i3,i1)],tritest$y[c(i1,i2,i3,i1)],col="red")
points(pnt$x,pnt$y)
```

*Documentation reproduced from package tripack, version 1.0-1, License: R functions: GPL, Fortran code: available at netlib*

### Community examples

Looks like there are no examples yet.