1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00

add ripples

This commit is contained in:
Justin Lin 2021-12-19 15:52:51 +08:00
parent 9facafaf61
commit 0fb6f4b9a1

View 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);
}