mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-16 19:54:29 +02:00
rename
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
use <hull_polyline2d.scad>;
|
use <hull_polyline2d.scad>;
|
||||||
use <experimental/marching_squares.scad>;
|
use <experimental/contours.scad>;
|
||||||
|
|
||||||
level_step = 51;
|
level_step = 51;
|
||||||
contour_width = 1.5;
|
contour_width = 1.5;
|
||||||
@@ -116,18 +116,14 @@ module image_slicer(levels, level_step, contour_width) {
|
|||||||
|
|
||||||
max_h = (floor(255 / level_step) + 1) * level_step;
|
max_h = (floor(255 / level_step) + 1) * level_step;
|
||||||
|
|
||||||
module contours(points, z, contour_width) {
|
|
||||||
union() {
|
|
||||||
for(iso_band = marching_squares(points, [0, z])) {
|
|
||||||
polygon([for(p = iso_band) [p[0], p[1]]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(z = [level_step:level_step:255]) {
|
for(z = [level_step:level_step:255]) {
|
||||||
linear_extrude((max_h - z) / level_step)
|
linear_extrude((max_h - z) / level_step)
|
||||||
offset(0.01) // Avoid warning
|
offset(0.01) // Avoid warning
|
||||||
contours(points, z, contour_width);
|
union() {
|
||||||
|
for(iso_band = contours(points, [0, z])) {
|
||||||
|
polygon([for(p = iso_band) [p[0], p[1]]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
use <experimental/_impl/_marching_squares_impl.scad>;
|
use <experimental/_impl/_contours_impl.scad>;
|
||||||
|
|
||||||
function marching_squares(points, threshold) =
|
function contours(points, threshold) =
|
||||||
is_undef(threshold[1]) ?
|
is_undef(threshold[1]) ?
|
||||||
_marching_squares_isolines(points, threshold) :
|
_marching_squares_isolines(points, threshold) :
|
||||||
_marching_squares_isobands(points, threshold[0], threshold[1]);
|
_marching_squares_isobands(points, threshold[0], threshold[1]);
|
@@ -1,7 +1,7 @@
|
|||||||
use <hull_polyline2d.scad>;
|
use <hull_polyline2d.scad>;
|
||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <experimental/pnoise2.scad>;
|
use <experimental/pnoise2.scad>;
|
||||||
use <experimental/marching_squares.scad>;
|
use <experimental/contours.scad>;
|
||||||
|
|
||||||
seed = rand(0, 256);
|
seed = rand(0, 256);
|
||||||
points = [
|
points = [
|
||||||
@@ -11,11 +11,11 @@ points = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
for(isoline = marching_squares(points, 0.1)) {
|
for(isoline = contours(points, 0.1)) {
|
||||||
hull_polyline2d(isoline, width = .1);
|
hull_polyline2d(isoline, width = .1);
|
||||||
}
|
}
|
||||||
|
|
||||||
translate([12, 0])
|
translate([12, 0])
|
||||||
for(isoband = marching_squares(points, [-.2, .2])) {
|
for(isoband = contours(points, [-.2, .2])) {
|
||||||
polygon([for(p = isoband) [p[0], p[1]]]);
|
polygon([for(p = isoband) [p[0], p[1]]]);
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
use <hull_polyline2d.scad>;
|
use <hull_polyline2d.scad>;
|
||||||
use <experimental/marching_squares.scad>;
|
use <experimental/contours.scad>;
|
||||||
|
|
||||||
levels = [
|
levels = [
|
||||||
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
|
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
|
||||||
@@ -111,7 +111,7 @@ points = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
for(z = [0:40:255]) {
|
for(z = [0:40:255]) {
|
||||||
for(isoline = marching_squares(points, z)) {
|
for(isoline = contours(points, z)) {
|
||||||
hull_polyline2d(isoline, width = .25);
|
hull_polyline2d(isoline, width = .25);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user