Learn R Programming

henna (version 0.3.4)

isPointOnBoundary: Check if a point is on a polygon boundary

Description

This function checks if a point P is on a polygon boundary.

Usage

isPointOnBoundary(xPoint, yPoint, boundary)

Value

Logical; whether the point is on the boundary.

Arguments

xPoint

x coordinate of point P.

yPoint

y coordinate of point P.

boundary

A data frame with four columns representing segments comprising the boundary.

Examples

Run this code
pointsDF <- data.frame(x = c(1, 2, 4, 7, 10,
12, 13, 15, 16),
y = c(1, 1, 2, 3, 3, 2,
1, 2, 1))

hullIndices <- grDevices::chull(pointsDF[, 1], pointsDF[, 2])
hull <- convexHull(pointsDF, hullIndices)
hullSegments <- pointsToSegments(hull)

isPointOnBoundary(2, 3, hullSegments)

Run the code above in your browser using DataLab