Add noise-gradient-fractal-value function (similar to noise-fractal-value, but use noise-gradient-value instead of noise-value).

This commit is contained in:
Feufochmar 2020-12-27 01:03:13 +01:00
parent 2690a9c527
commit 9e4f49ab04
1 changed files with 17 additions and 1 deletions

View File

@ -9,7 +9,8 @@
make-noise
noise-value
noise-gradient-value
noise-fractal-value)
noise-fractal-value
noise-gradient-fractal-value)
; Structure
(struct s-noise
@ -185,3 +186,18 @@
coords)))))
0
(build-list octaves values)))
; Same as above, but use the noise-gradient-value instead of the noise-value
(define (noise-gradient-fractal-value ns octaves persistance . coords)
(foldl
(lambda (i res)
(+ res
(* (expt persistance i)
(apply
noise-gradient-value
ns
(map
(lambda (x) (* (+ i 1) x))
coords)))))
0
(build-list octaves values)))