Learn R Programming

ambient (version 1.0.2)

gen_spheres: Generate a pattern of concentric spheres

Description

This generator creates a pattern of concentric circles centered at 0. Depending on how many dimensions you supply it can be used to generate cylinders and circles as well. The output value is the shortest distance to the nearest sphere normalised to be between -1 and 1. The frequency determines the radius multiplier for each unit sphere.

Usage

gen_spheres(x, y = NULL, z = NULL, t = NULL, frequency = 1, ...)

Value

A numeric vector

Arguments

x, y, z, t

The coordinates to get pattern from

frequency

The frequency of the generator

...

ignored

See Also

Other Pattern generators: gen_checkerboard(), gen_waves()

Examples

Run this code
grid <- long_grid(seq(1, 10, length.out = 1000), seq(1, 10, length.out = 1000))
grid$circles <- gen_spheres(grid$x, grid$y)
grid$cylinders <- gen_spheres(grid$x)

plot(grid, circles)
plot(grid, cylinders)

Run the code above in your browser using DataLab