1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 09:44:16 +02:00

change params

This commit is contained in:
Justin Lin
2022-04-01 17:11:29 +08:00
parent 356966b8f6
commit 4e0078f25c

View File

@@ -1,11 +1,12 @@
use <noise/nz_worley2.scad>; use <noise/nz_worley2.scad>;
use <noise/nz_perlin3.scad>; use <noise/nz_perlin2.scad>;
use <surface/sf_thicken.scad>; use <surface/sf_thicken.scad>;
size = [100, 100]; size = [30, 30];
grid_w = 5; grid_w = 15;
amplitude = 3; amplitude = 1;
detail = 5; mesh_w = 0.2;
wave_smoothness = 20;
thickness = 0.5; thickness = 0.5;
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border] dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
seed = 51; seed = 51;
@@ -13,27 +14,24 @@ seed = 51;
ripples(); ripples();
module ripples() { module ripples() {
points = [ point_size = size / mesh_w;
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)]; points = [for(y = [0:point_size.y - 1], x = [0:point_size.x - 1]) [x, y] * mesh_w];
detail2 = detail / 2 * 10; noise = [for(p = points) nz_worley2(p.x, p.y, seed, grid_w, dist)[2]];
nz2 = [
for(y = [0:size.y - 1]) sf = [
[for(x = [0:size.x - 1]) for(y = [0:point_size.y - 1])
[for(x = [0:point_size.x - 1])
let( let(
i = size.x * y + x, i = point_size.x * y + x,
nz = noise[i],
p = points[i], p = points[i],
n = amplitude * nz_perlin3(cells[i][2], p.x / detail2, p.y / detail2, 1) n = amplitude * nz_perlin2(nz + p.x / wave_smoothness, nz + p.y / wave_smoothness, seed)
) )
[p.x, p.y, n] [p.x, p.y, n]
] ]
]; ];
sf_thicken(sf, thickness);
sf_thicken(nz2, thickness);
} }