Description Usage Arguments Value Author(s) Examples
View source: R/stemMappingExtension.R
The function cuts a circle stem map into a largest hexagon in circle and extends this hexagon to a target area and shape. This is a generic function.
1 2 | stemMappingExtension(objectID, azimuth, distance, radius = 11.28,
targetArea = 1, targetShape = "square", randomRotate = FALSE)
|
objectID |
character, A object's ID, e.g., a tree's ID. |
azimuth |
numeric, Azimuth of a object from the north. It should be between 0 to 360. |
distance |
numeric, Distance between a object and the centre of the circle. |
radius |
numeric, Radius of the circle. If missing, |
targetArea |
numeric, Defines the area you may want to extend. The unit of this input is |
targetShape |
character, Defines the shape of the target area. It currently supports |
randomRotate |
logical, Defines whether need to random rotate the hexagon when merge into
a |
A table contains the x and y for all the objects in the extended area.
Yong Luo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Not run:
## randomly generate some trees
library(data.table)
smallplottrees <- data.table(tree_id = 1:20,
angle = runif(20, min = 0, max = 360),
distance = runif(20, min = 0, max = 5.6))
## extend it to 1 ha
treelist_smallplot <- stemMappingExtension(objectID = smallplottrees$tree_id,
azimuth = smallplottrees$angle,
distance = smallplottrees$distance,
radius = 5.64,
randomRotate = TRUE)
bigplottrees <- data.table(tree_id = 1:20,
angle = runif(20, min = 0, max = 360),
distance = runif(20, min = 0, max = 11.28))
## extend it to 1 ha
treelist_bigplot <- stemMappingExtension(objectID = bigplottrees$tree_id,
azimuth = bigplottrees$angle,
distance = bigplottrees$distance,
radius = 11.28)
treelist_smallplot[, source := "smallplot"]
treelist_bigplot[, source := "bigplot"]
alltreelist <- rbind(treelist_bigplot, treelist_smallplot)
alltreeplot <- ggplot(data = alltreelist, aes(x, y))+
geom_point(aes(col = factor(source)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.