1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-23 17:15:05 +01:00
dotSCAD/examples/voronoi/ripples.scad

39 lines
735 B
OpenSCAD
Raw Normal View History

2021-12-19 15:52:51 +08:00
use <noise/nz_worley2.scad>;
use <noise/nz_perlin3.scad>;
use <surface/sf_thicken.scad>;
size = [100, 100];
grid_w = 5;
2021-12-19 16:00:03 +08:00
amplitude = 3;
2021-12-19 15:52:51 +08:00
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],
2021-12-19 16:00:03 +08:00
n = amplitude * nz_perlin3(cells[i][2], p.x / detail2, p.y / detail2, 1)
2021-12-19 15:52:51 +08:00
)
[p.x, p.y, n]
]
];
sf_thicken(nz2, thickness);
}