tri.find | R Documentation |
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.
tri.find(tri.obj,x,y)
tri.obj |
an triangulation object |
x |
x-coordinate of the point |
y |
y-coordinate of the point |
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.
A. Gebhardt
R. J. Renka (1996). Algorithm 751: TRIPACK: a constrained two-dimensional Delaunay triangulation package. ACM Transactions on Mathematical Software. 22, 1-8.
tri
, print.tri
, plot.tri
,
summary.tri
, triangles
,
convex.hull
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.