diff --git a/src/experimental/demo/marching_squares_demo.scad b/src/experimental/demo/marching_squares_demo.scad index d86bc043..dac1da0a 100644 --- a/src/experimental/demo/marching_squares_demo.scad +++ b/src/experimental/demo/marching_squares_demo.scad @@ -3,6 +3,8 @@ use ; use ; use ; +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); - } -} \ No newline at end of file +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]]]); + } + } +} \ No newline at end of file