splitCanopy: Split a whole canopy in accordance with a set of volumes

Description Usage Arguments Value Examples

Description

Each polygon of the canopy that is included in one of the provided volumes is allocated to this volume. If a polygon crosses one or several sides of a volume and if the parameter shred is set to TRUE, then the polygon is recursively shreded into smaller polygons until none of them (with an area > epsilon) crosses the volume sides anymore.

Usage

1
2
splitCanopy(canopy, volumeSet, shred = TRUE, epsilon = 1e-06,
  parallel = FALSE, nCores = 2)

Arguments

canopy

A Canopy object.

volumeSet

A VolumeSet object.

shred

Logical. Should an intersected polygon be shreded into smaller polygons?

epsilon

Minimal polygon area to take into account.

parallel

Logical. Parallelization activation.

nCores

Number of cores to use if parallel is set to TRUE.

Value

A c("Canopy", "data.frame") object containing only the polygons that were successfully allocated to a volume.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
rangeDim <- function(can, dim) {
    range(sapply(can$vertices, function(i) range(i[, dim])))
}
volumes <- makeVolumeSet(rangeDim(plants, "x"),
                         rangeDim(plants, "y"),
                         rangeDim(plants, "z"),
                         intervals = rep(3, 3))

# With no parallelization:
allocatedPolygons <- splitCanopy(plants, volumes, shred = TRUE)

# With parallelization (experimental feature):
allocatedPolygons <- splitCanopy(plants, volumes, shred = TRUE,
                                 parallel = TRUE, nCores = 8)

chgigot/canis documentation built on May 13, 2019, 3:56 p.m.