determine whether points is in convex hull

.inhull(
  testpts,
  calpts,
  hull = geometry::convhulln(calpts),
  tol = mean(mean(abs(calpts))) * sqrt(.Machine$double.eps)
)

Arguments

testpts

A dataframe contain testing point

calpts

A dataframe contain point to determine convex hull.

hull

Create hull to test whether testpts in hull. By default will create by geometry::convhulln(calpts).

tol

Tolerance. By defualt is mean(mean(abs(calpts)))*sqrt(.Machine$double.eps)).

Value

An indicator weather each point belongs to the convex hull spanned by calpts.