inhulln: Test if points lie in convex hull

Description Usage Arguments Value Author(s) See Also Examples

View source: R/inhulln.R

Description

Test if points lie in convex hull

Usage

1
inhulln(ch, p)

Arguments

ch

Convex hull produced using convhulln

p

An n-by-dim matrix of points to test. The rows of p represent n points in dim-dimensional space.

Value

A booean vector with n elements

Author(s)

David Sterratt

See Also

convhulln

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
p <- cbind(c(-1, -1, 1), c(-1, 1, -1))
ch <- convhulln(p)
## First point should be in the hull; last two outside
inhulln(ch, rbind(c(-0.5, -0.5),
                  c( 1  ,  1),
                  c(10  ,  0)))

## Test hypercube
p <- rbox(4, B=1)
ch <- convhulln(p)
tp <-  cbind(seq(-1.9, 1.9, by=0.2), 0, 0, 0)
pin <- inhulln(ch, tp)
## Points on x-axis should be in box only between -1 and 1
pin == (tp[,1] < 1 & tp[,1] > -1)

geometry documentation built on May 2, 2019, 6:09 p.m.

Related to inhulln in geometry...