1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-30 01:40:02 +02:00

change dir

This commit is contained in:
Justin Lin
2020-02-19 12:49:50 +08:00
parent ce1ef24d64
commit 5849718ed5

View File

@@ -6,44 +6,26 @@ use <experimental/sf_solidify.scad>;
invert: inverts how the gray levels are translated into height values. invert: inverts how the gray levels are translated into height values.
*/ */
module sf_square(levels, thickness, invert = false) { module sf_square(levels, thickness, invert = false) {
columns = len(levels); rows = len(levels);
rows = len(levels[0]); columns = len(levels[0]);
offset_z = invert ? thickness : 0;
size = [columns - 1, rows - 1]; size = [columns - 1, rows - 1];
surface1 = [
for(r = [0:rows - 1])
[
for(c = [0:columns - 1])
let(lv = invert ? 255 - levels[c][r] : levels[c][r])
[c, r, lv / 255 * thickness]
]
];
surface2 = [
for(r = [0:rows - 1])
[
for(c = [0:columns - 1])
[c, r, 0]
]
];
offset_z = invert ? thickness : 0;
sf_solidify( sf_solidify(
[ [
for(r = [0:rows - 1]) for(r = [0:rows - 1])
[ [
for(c = [0:columns - 1]) for(c = [0:columns - 1])
let(lv = invert ? 255 - levels[c][r] : levels[c][r]) let(lv = invert ? 255 - levels[rows - r - 1][c] : levels[rows - r - 1][c])
[c, r, lv / 255 * thickness + offset_z] [c, r, lv / 255 * thickness + offset_z]
] ]
], ],
[ [
for(r = [0:rows - 1]) for(r = [0:rows - 1])
[ [
for(c = [0:columns - 1]) for(c = [0:columns - 1])
[c, r, 0] [c, r, 0]
] ]
] ]
); );
} }