Learn R Programming

rayimage (version 0.15.1)

render_boolean_distance: Render Boolean Distance

Description

Takes an matrix (or and returns the nearest distance to each TRUE.

Usage

render_boolean_distance(boolean, rescale = FALSE)

Value

Matrix of distance values.

Arguments

boolean

Logical matrix (or matrix of 1s and 0s), where distance will be measured to the TRUE values.

rescale

Default FALSE. Rescales the calculated distance to a range of 0-1. Useful for visualizing the distance matrix.

Examples

Run this code
if(run_documentation()){
#Measure distance to
plot_image(render_boolean_distance(t(volcano) > 150))
plot_image(render_boolean_distance(t(volcano) < 150))
}
if(run_documentation()){
#If we want to rescale this to zero to one (to visualize like an image), set rescale=TRUE
plot_image(render_boolean_distance(t(volcano) > 150,rescale=TRUE))
}

Run the code above in your browser using DataLab