Learn R Programming

rayshader (version 0.13.2)

reduce_matrix_size: Reduce Matrix Size

Description

Reduces the resolution of the matrix by specifyin the desired output dimensions, or a scaling factor.

Usage

reduce_matrix_size(heightmap, scale = 0.5, width = NULL,
  height = NULL)

Arguments

heightmap

The elevation matrix.

scale

Default `0.5`. The amount to scale down the matrix. Scales down using bilinear interpolation.

width

Default `NULL`. Alternative to `scale` argument. The desired output width. If `width` is less than 1, it will be interpreted as a scaling factor-- e.g. 0.5 would halve the resolution for the width.

height

Default `NULL`. Alternative to `scale` argument. The desired output width. If `height` is less than 1, it will be interpreted as a scaling factor-- e.g. 0.5 would halve the resolution for the height.

Examples

Run this code
# NOT RUN {
#Reduce the size of the monterey bay dataset by half

montbaysmall = reduce_matrix_size(montereybay, 0.5)
montbaysmall %>%
 sphere_shade() %>%
 plot_map()

#Reduce the size of the monterey bay dataset from 401x401 to 100x100

montbaysmall = reduce_matrix_size(montereybay, width = 100, height = 100)
montbaysmall %>%
 sphere_shade() %>%
 plot_map()
# }

Run the code above in your browser using DataLab