1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 09:44:16 +02:00
This commit is contained in:
Justin Lin
2020-03-29 10:57:42 +08:00
parent c3ff0cf7b1
commit 70eb71f946
3 changed files with 0 additions and 40 deletions

View File

@@ -1,6 +0,0 @@
use <experimental/sum.scad>;
function _manhattan(v) = sum([for(d = v) abs(d)]);
function _chebyshev(p1, p2) =
max([for(i = [0:len(p1) - 1]) abs(p1[i] - p2[i])]);

View File

@@ -1,24 +0,0 @@
use <experimental/zip.scad>;
use <experimental/worley_noise.scad>;
size = [50, 50];
n = 50;
xs = rands(0, size[0] - 1, n);
ys = rands(0, size[1] - 1, n);
points = zip([xs, ys]);
noised = [
for(y = [0:size[1] - 1])
for(x = [0:size[0] - 1])
[x, y, worley_noise([x, y], points)]
];
max_dist = max([for(n = noised) n[2]]);
for(n = noised) {
c = n[2] / max_dist;
color([c, c, c])
linear_extrude(c * max_dist)
translate([n[0], n[1]])
square(1);
}

View File

@@ -1,10 +0,0 @@
use <experimental/_impl/_worley_noise_impl.scad>;
function worley_noise(p, points, dist = "euclidean") =
let(
dists = dist == "euclidean" ? [for(i = [0:len(points) - 1]) norm(points[i] - p)] :
dist == "manhattan" ? [for(i = [0:len(points) - 1]) _manhattan(points[i] - p)] :
dist == "chebyshev" ? [for(i = [0:len(points) - 1]) _chebyshev(points[i], p)] :
assert("Unknown distance option")
)
min(dists);