tri.find: Locate a point in a triangulation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/tri.find.R

Description

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

1
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,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.

Author(s)

A. Gebhardt

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

1
2
3
4
5
6
7
8
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)

tripack documentation built on July 8, 2020, 5:59 p.m.

Related to tri.find in tripack...