Most modifications of values in a long_grid are quite simple due to the wealth of vectorised functions avaliable in R. ambient provides a little selection of handy functions to compliment these

blend(x, y, mask) normalise(x, from = range(x), to = c(0, 1)) normalize(x, from = range(x), to = c(0, 1)) cap(x, lower = 0, upper = 1)

x, y | Aalues to modify |
---|---|

mask | A vector of the same length as |

from | The range of |

to | The output domain to normalise to |

lower, upper | The lower and upper bounds to cap to |

grid <- long_grid(seq(1, 10, length.out = 1000), seq(1, 10, length.out = 1000)) grid$chess <- gen_checkerboard(grid$x, grid$y) grid$noise <- gen_perlin(grid$x, grid$y) grid$ripple <- gen_waves(grid$x, grid$y) # Blend two values based on a third grid$mix <- blend(grid$noise, grid$ripple, grid$chess) plot(grid, mix)