R: Compute convex hull of intersection of two sets of points

intersectn {geometry} | R Documentation

## Compute convex hull of intersection of two sets of points

### Description

Compute convex hull of intersection of two sets of points

### Usage

    intersectn(ps1, ps2, tol = 0, return.chs = TRUE)

### Arguments

`ps1` | First set of points
`ps2` | Second set of points
`tol` | Tolerance used to determine if a feasible point lies within the convex hulls of both points and to round off the points generated by the halfspace intersection, which sometimes produces points very close together.
`return.chs` | If `TRUE` (default) return the convex hulls of the first and second sets of points, as well as the convex hull of the intersection.

### Value

List containing named elements: `ch1`, the convex hull of the first set of points, with volumes, areas and normals (see `convhulln`; `ch2`, the convex hull of the first set of points, with volumes, areas and normals; `ps`, the intersection points of convex hulls `ch1` and `ch2`; and `ch`, the convex hull of the intersection points, with volumes, areas and normals.

### Author(s)

David Sterratt

### See Also

convhulln, halfspacen, inhulln

### Examples

    # Two overlapping boxes
    ps1 <- rbox(0, C=0.5)
    ps2 <- rbox(0, C=0.5) + 0.5
    out <- intersectn(ps1, ps2)
    message(paste("Volume of 1st convex hull:", out$ch1$vol))
    message(paste("Volume of 2nd convex hull:", out$ch2$vol))
    message(paste("Volume of intersection convex hull:", out$ch$vol))

[Package geometry version 0.4.0 Index]