Merge branch 'master' of git://factorcode.org/git/factor
commit
f70bd15131
|
@ -1,4 +1,4 @@
|
||||||
USING: byte-arrays combinators images kernel locals math
|
USING: byte-arrays combinators images kernel locals math math.affine-transforms
|
||||||
math.functions math.polynomials math.vectors random sequences
|
math.functions math.polynomials math.vectors random sequences
|
||||||
sequences.product ;
|
sequences.product ;
|
||||||
IN: perlin-noise
|
IN: perlin-noise
|
||||||
|
@ -70,14 +70,14 @@ IN: perlin-noise
|
||||||
[ faded second lerp ] 2bi@
|
[ faded second lerp ] 2bi@
|
||||||
faded third lerp ;
|
faded third lerp ;
|
||||||
|
|
||||||
: noise-map ( table scale dim -- map )
|
: noise-map ( table transform dim -- map )
|
||||||
[ iota ] map [ v* 0.0 suffix noise ] with with product-map ;
|
[ iota ] map [ a.v 0.0 suffix noise ] with with product-map ;
|
||||||
|
|
||||||
: normalize ( sequence -- sequence' )
|
: normalize-0-1 ( sequence -- sequence' )
|
||||||
[ supremum ] [ infimum [ - ] keep ] [ ] tri
|
[ supremum ] [ infimum [ - ] keep ] [ ] tri
|
||||||
[ swap - ] with map [ swap / ] with map ;
|
[ swap - ] with map [ swap / ] with map ;
|
||||||
|
|
||||||
: noise-image ( table scale dim -- image )
|
: noise-image ( table transform dim -- image )
|
||||||
[ noise-map normalize [ 255.0 * >fixnum ] B{ } map-as ]
|
[ noise-map normalize-0-1 [ 255.0 * >fixnum ] B{ } map-as ]
|
||||||
[ swap [ L f ] dip image boa ] bi ;
|
[ swap [ L f ] dip image boa ] bi ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue