1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-17 12:10:47 +02:00

add spiral_ripples

This commit is contained in:
Justin Lin
2022-07-30 09:11:12 +08:00
parent 390bef0061
commit 1e1587c600

View File

@@ -0,0 +1,42 @@
use <noise/nz_cell.scad>
use <golden_spiral.scad>
use <noise/nz_perlin2.scad>
use <surface/sf_thicken.scad>
use <util/radians.scad>
amplitude = 2;
angle_step = 30;
voxel_step = 0.2;
wave_step = 0.1;
thickness = 0.5;
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
seed = 51;
spiral_ripples();
module spiral_ripples() {
phi = (1 + sqrt(5)) / 2;
degrees = 720;
points = [
for(d = [0:angle_step:degrees])
let(
theta = radians(d),
r = pow(phi, theta * 2 / PI)
)
r * [cos(d), sin(d)]
];
sf = [
for(y = [-45:voxel_step:30])
[
for(x = [-40:voxel_step:70])
let(
nz = nz_cell(points, [x, y], dist),
n = amplitude * nz_perlin2(nz + x * wave_step, nz + y * wave_step, seed)
)
[x, y, n]
]
];
sf_thicken(sf, thickness);
}