mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-03-14 02:59:42 +01:00
add worley noise demo
This commit is contained in:
parent
6fbf01648e
commit
c26e564152
24
src/experimental/demo/worley_noise_demo.scad
Normal file
24
src/experimental/demo/worley_noise_demo.scad
Normal file
@ -0,0 +1,24 @@
|
||||
use <experimental/zip.scad>;
|
||||
use <experimental/worley_noise.scad>;
|
||||
|
||||
size = [50, 50];
|
||||
n = 50;
|
||||
xs = rands(0, size[0] - 1, n);
|
||||
ys = rands(0, size[1] - 1, n);
|
||||
points = zip([xs, ys]);
|
||||
|
||||
noised = [
|
||||
for(y = [0:size[1] - 1])
|
||||
for(x = [0:size[0] - 1])
|
||||
[x, y, worley_noise([x, y], points)]
|
||||
];
|
||||
|
||||
max_dist = max([for(n = noised) n[2]]);
|
||||
|
||||
for(n = noised) {
|
||||
c = n[2] / max_dist;
|
||||
color([c, c, c])
|
||||
linear_extrude(c * max_dist)
|
||||
translate([n[0], n[1], n[2]])
|
||||
square(1);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user