View source: R/on.convex.hull.R
on.convex.hull | R Documentation |
Given a triangulation object tri.obj
of n
points in the plane, this
subroutine returns a logical vector indicating if the points
(x_i,y_i)
lay on or in the convex hull of tri.obj
.
on.convex.hull(tri.obj, x, y, eps=1E-16)
in.convex.hull(tri.obj, x, y, eps=1E-16, strict=TRUE)
tri.obj |
object of class |
x |
vector of |
y |
vector of |
eps |
accuracy for checking the condition |
strict |
logical, default |
Logical vector.
Albrecht Gebhardt <albrecht.gebhardt@aau.at>, Roger Bivand <roger.bivand@nhh.no>
triSht
, print.triSht
, plot.triSht
,
summary.triSht
, triangles
,
convex.hull
.
# use a part of the quakes data set:
data(quakes)
quakes.part<-quakes[(quakes[,1]<=-10.78 & quakes[,1]>=-19.4 &
quakes[,2]<=182.29 & quakes[,2]>=165.77),]
q.tri<-tri.mesh(quakes.part$lon, quakes.part$lat, duplicate="remove")
on.convex.hull(q.tri,quakes.part$lon[1:20],quakes.part$lat[1:20])
# Check with part of data set:
# Note that points on the hull (see above) get marked FALSE below:
in.convex.hull(q.tri,quakes.part$lon[1:20],quakes.part$lat[1:20])
# If points both on the hull and in the interior of the hull are meant
# disable strict mode:
in.convex.hull(q.tri,quakes.part$lon[1:20],quakes.part$lat[1:20],strict=FALSE)
# something completely outside:
in.convex.hull(q.tri,c(170,180),c(-20,-10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.