1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-07 07:16:36 +02:00

add sf_ring

This commit is contained in:
Justin Lin
2020-02-19 14:43:12 +08:00
parent 7a52bf3b00
commit 8a609c2f57

View File

@@ -0,0 +1,36 @@
use <experimental/_impl/_sf_square_surfaces.scad>;
use <experimental/sf_solidify.scad>;
use <experimental/tf_ring.scad>;
/*
levels : A list of numbers (0 ~ 255).
radius: The radius of the arc after being bent
thickness: shell thickness
angle: The central angle of the arc..
invert: inverts how the gray levels are translated into height values.
*/
module sf_ring(levels, radius, thickness, angle = 360, invert = false) {
surface = _sf_square_surfaces(levels, thickness, invert);
rows = len(levels);
columns = len(levels[0]);
size = [columns - 1, rows - 1];
offset_z = invert ? thickness : 0;
sf_solidify(
[
for(row = surface[0])
[
for(p = row)
tf_ring(size, p, radius, angle, 0) + + [0, 0, offset_z]
]
],
[
for(row = surface[1])
[
for(p = row)
tf_ring(size, p, radius, angle, 0)
]
]
);
}