-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_crown_file.R
46 lines (46 loc) · 1.52 KB
/
get_crown_file.R
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
35
36
37
38
39
40
41
42
43
44
45
46
#'@title Get a 3D Crown File
#'
#'@description Generate a specific 3D representation of a tree crown,
#'given the parameters for the type of tree crown, the desired level of detail
#'or resolution, and whether or not to offset the crown to align it with the
#'trunk at the origin.
#'
#'@param tree Default `"rounded"`. Crown type. Full list of options:
#'`"columnar"`
#'`"pyramidal1"`
#'`"pyramidal2"`
#'`"oval"`
#'`"palm"`
#'`"rounded"`
#'`"spreading1"`
#'`"spreading2"`
#'`"vase"`
#'`"weeping"`
#'@param resolution Default `"medium"`. Level of detail of the tree mesh. All options:
#'`"low"`
#'`"medium"`
#'`"high`
#'@param offset_origin Default `TRUE`. Whether to offset the crown so that the bottom of the
#'tree will be exactly at the origin, aligning it with the trunk.
#' @param solid Default `FALSE`. Whether the crown should be a solid mesh (`TRUE`), or a collection of flat
#' 2D planes (`FALSE`).
#'@export
#'
#'@return Filename of OBJ file (as `.txt` file)
#'@examples
#'#Get a crown OBJ
#'get_crown_file(tree = "rounded", resolution = "high")
get_crown_file = function(tree = "oval",
resolution = "medium",
offset_origin = TRUE,
solid = FALSE) {
if(solid) {
get_solid_crown_file(tree = tree,
resolution = resolution,
offset_origin = offset_origin)
} else {
get_flat_crown_file(tree = tree,
resolution = resolution,
offset_origin = offset_origin)
}
}