Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

calculate_normal

Calculate Normal


Description

Calculates the normal unit vector for every point on the grid.

Usage

calculate_normal(heightmap, zscale = 1, progbar = FALSE)

Arguments

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.

Value

Matrix of light intensities at each point.

Examples

#Here we produce a light intensity map of the `volcano` elevation map.

#Cache the normal vectors of the volcano dataset
volcanocache = calculate_normal(volcano)

#Use the cached vectors to speed up calculation of `sphere_shade()` on a map.
sphere_shade(volcano,normalvectors = volcanocache) %>%
 plot_map()

rayshader

Create Maps and Visualize Data in 2D and 3D

v0.24.10
GPL-3
Authors
Tyler Morgan-Wall
Initial release
2021-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.