View source: R/calculate_normal.R
calculate_normal | R Documentation |
Calculates the normal unit vector for every point on the grid.
calculate_normal(heightmap, zscale = 1, progbar = FALSE)
heightmap |
A two-dimensional matrix, where each entry in the matrix is the elevation at that point. All points are assumed to be evenly spaced. |
zscale |
Default 1. |
progbar |
Default 'FALSE'. If 'TRUE', turns on progress bar. |
Matrix of light intensities at each point.
#Here we produce a light intensity map of the `volcano` elevation map.
#Cache the normal vectors of the volcano dataset
if(run_documentation()) {
volcanocache = calculate_normal(volcano)
}
#Use the cached vectors to speed up calculation of `sphere_shade()` on a map.
if(run_documentation()) {
sphere_shade(volcano,normalvectors = volcanocache) %>%
plot_map()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.