calcConvexHull: Calculate Convex Hull for a Set of Points

View source: R/PBSmapping.r

calcConvexHullR Documentation

Calculate Convex Hull for a Set of Points

Description

Calculate the convex hull for a set of points.

Usage

calcConvexHull(xydata, keepExtra=FALSE)
.closestPoint(pts, pt)

Arguments

xydata

numeric – data frame with columns 'X' and 'Y' containing spatial coordinates

keepExtra

logical – if TRUE, retain any additional columns from the input data frame 'xydata'.

pts

numeric – data frame with columns 'X' and 'Y'

pt

numeric – data frame with columns 'X' and 'Y' and ONE row

Details

Uses the function chull() in the package grDevices. By default, it ignores all columns other than X and Y; however, the user can choose to retain additional columns in xydata by specifying keepExtra=TRUE.

Value

PolySet with columns PID, POS, X, Y, and additional columns in xydata if keepExtra=TRUE.

Auxiliary dot function '.closestPoint' returns a vector of length 'pts' where TRUE indicates that the point is closest to 'pt'. Returns several TRUE values when several points are equidistant.

Author(s)

Nicholas M. Boers, Software Engineer, Jobber, Edmonton AB

Maintainer: Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Remote office, Vancouver BC
Last modified Rd: 2024-09-03

See Also

In package PBSmapping:
addPoints, addPolys, calcArea, calcCentroid, calcMidRange, calcSummary, locateEvents, plotMap, plotPoints, plotPolys.

Examples

local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  data(surveyData,envir=.PBSmapEnv)
  #--- plot the convex hull, and then plot the points
  plotMap(calcConvexHull(surveyData),col="moccasin")
  addPoints(surveyData,col="blue",pch=17,cex=.6)
  par(oldpar)
})

PBSmapping documentation built on Sept. 30, 2024, 9:21 a.m.