Learn R Programming

OptimaRegion (version 0.2)

plotConvexHull: Computes and displays the convex hull of a set of 2-dimensional points

Description

Given a vector of 2-dimensional coordinates, computes and displays the convex hull formed by these points.

Usage

plotConvexHull(xin, LB, UB, xlab, ylab)

Arguments

xin

n x 2 vector of coordinate points

LB

2x1 vector of lower bounds for the x,y region where the convex hull is to be plot. Required.

UB

2x1 vector of lower bounds for the x,y region where the convex hull is to be plot. Required.

xlab

Label for x axis.

ylab

Label for y axis.

Value

An integer vector giving the indices of the unique points lying on the convex hull, in clockwise order. (The first will be returned for duplicate points.). Same as returned by chull(xin).

Examples

Run this code
# NOT RUN {
## Generate some random 2-dimensional point set

X<-cbind(runif(100,-2,2),runif(100,-2,2))

## Compute and plot convex hull

plotConvexHull(xin=X, LB=c(-4,-4), UB=c(4,4), xlab='X', ylab='Y')
# }

Run the code above in your browser using DataLab