is_convex_hull: Is Convex Hull

View source: R/is_convex_hull.R

is_convex_hullR Documentation

Is Convex Hull

Description

Test if a given set of vertices construct a convex hull.

Usage

is_convex_hull(x)

Arguments

x

sccm_pg object.

See Also

polygon convex_hull is_anticlockwise

Examples

xvert <- c(0, 5, 6, 4, 2, 0)
yvert <- c(0, 0, 1, 3, 3, 2)

pg <- polygon(xvert, yvert)
is_convex_hull(pg)

# reverse the order of the vertices, still an convex hull.
is_convex_hull(polygon(pg$vertices[rev(1:nrow(pg$vertices)), ] ))

# order of the vertices is important
is_convex_hull(polygon(pg$vertices[c(2, 3, 1, 6, 4, 5), ] ))

star <- 
   rbind(sccm::polar2cartesian(r = 1.0, theta = seq(0, 1.6, by = 0.4) * pi),
         sccm::polar2cartesian(r = 0.6, theta = seq(0.2, 1.8, by = 0.4) * pi))

is_convex_hull(polygon(star))


dewittpe/sccm documentation built on Feb. 2, 2024, 5:25 p.m.