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

update demo

This commit is contained in:
Justin Lin
2020-03-22 17:20:30 +08:00
parent 7e9e66d8c2
commit 90d09441df

View File

@@ -3,6 +3,8 @@ use <util/rand.scad>;
use <experimental/pnoise2.scad>; use <experimental/pnoise2.scad>;
use <experimental/marching_squares.scad>; use <experimental/marching_squares.scad>;
style = "ISOLINES"; // [ISOLINES, ISOBANDS]
seed = rand(0, 256); seed = rand(0, 256);
points = [ points = [
for(y = [0:.2:10]) [ for(y = [0:.2:10]) [
@@ -10,6 +12,7 @@ points = [
] ]
]; ];
if(style == "ISOLINES") {
for(row = marching_squares(points, 0.1)) { for(row = marching_squares(points, 0.1)) {
for(line = row) { for(line = row) {
p0 = [line[0][0], line[0][1]]; p0 = [line[0][0], line[0][1]];
@@ -17,3 +20,11 @@ for(row = marching_squares(points, 0.1)) {
hull_polyline2d([p0, p1], width = .1); hull_polyline2d([p0, p1], width = .1);
} }
} }
}
else {
for(row = marching_squares(points, [-.2, .2])) {
for(iso_band = row) {
polygon([for(p = iso_band) [p[0], p[1]]]);
}
}
}