1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-14 02:34:12 +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/marching_squares.scad>;
style = "ISOLINES"; // [ISOLINES, ISOBANDS]
seed = rand(0, 256);
points = [
for(y = [0:.2:10]) [
@@ -10,10 +12,19 @@ points = [
]
];
for(row = marching_squares(points, 0.1)) {
for(line = row) {
p0 = [line[0][0], line[0][1]];
p1 = [line[1][0], line[1][1]];
hull_polyline2d([p0, p1], width = .1);
}
}
if(style == "ISOLINES") {
for(row = marching_squares(points, 0.1)) {
for(line = row) {
p0 = [line[0][0], line[0][1]];
p1 = [line[1][0], line[1][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]]]);
}
}
}