mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
add ripples
This commit is contained in:
parent
9facafaf61
commit
0fb6f4b9a1
38
examples/voronoi/ripples.scad
Normal file
38
examples/voronoi/ripples.scad
Normal file
@ -0,0 +1,38 @@
|
||||
use <noise/nz_worley2.scad>;
|
||||
use <noise/nz_perlin3.scad>;
|
||||
use <surface/sf_thicken.scad>;
|
||||
|
||||
size = [100, 100];
|
||||
grid_w = 5;
|
||||
detail = 5;
|
||||
thickness = 0.5;
|
||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||
seed = 51;
|
||||
|
||||
ripples();
|
||||
|
||||
module ripples() {
|
||||
points = [
|
||||
for(y = [0:size.y - 1])
|
||||
for(x = [0:size.x - 1])
|
||||
[x, y]
|
||||
];
|
||||
|
||||
cells = [for(p = points) nz_worley2(p.x / detail, p.y / detail, seed, grid_w, dist)];
|
||||
|
||||
detail2 = detail / 2 * 10;
|
||||
nz2 = [
|
||||
for(y = [0:size.y - 1])
|
||||
[for(x = [0:size.x - 1])
|
||||
let(
|
||||
i = size.x * y + x,
|
||||
p = points[i],
|
||||
n = 2.5 * (nz_perlin3(cells[i][2], p.x / detail2, p.y / detail2, 1) + 1)
|
||||
)
|
||||
[p.x, p.y, n]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
sf_thicken(nz2, thickness);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user