TriangleInHull {Ternary} | R Documentation |
Does triangle overlap convex hull of points?
Description
Does triangle overlap convex hull of points?
Usage
TriangleInHull(triangles, coordinates, buffer)
Arguments
triangles |
Three-row matrix as produced by |
coordinates |
A matrix with two or three rows specifying the coordinates of points in x, y or a, b, c format. |
buffer |
Include triangles whose centres lie within |
Value
TriangleInHull()
returns a list with the elements:
-
$inside
: vector specifying whether each of a set of triangles produced byTriangleCentres()
overlaps the convex hull of points specified bycoordinates
. -
$hull
: Coordinates of convex hull ofcoordinates
, after expansion to cover overlapping triangles.
Author(s)
Martin R. Smith (martin.smith@durham.ac.uk)
See Also
Other tiling functions:
Polygon-Geometry
,
TriangleCentres()
Examples
set.seed(0)
nPts <- 50
a <- runif(nPts, 0.3, 0.7)
b <- 0.15 + runif(nPts, 0, 0.7 - a)
c <- 1 - a - b
coordinates <- rbind(a, b, c)
TernaryPlot(grid.lines = 5)
TernaryPoints(coordinates, pch = 3, col = 4)
triangles <- TriangleCentres(resolution = 5)
inHull <- TriangleInHull(triangles, coordinates)
polygon(inHull$hull, border = 4)
values <- rbind(triangles,
z = ifelse(inHull$inside, "#33cc3333", "#cc333333"))
points(triangles["x", ], triangles["y", ],
pch = ifelse(triangles["triDown", ], 6, 2),
col = ifelse(inHull$inside, "#33cc33", "#cc3333"))
ColourTernary(values)
[Package Ternary version 2.3.2 Index]