mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-07 07:16:36 +02:00
add sf_cylinder
This commit is contained in:
30
src/surface/sf_cylinder.scad
Normal file
30
src/surface/sf_cylinder.scad
Normal file
@@ -0,0 +1,30 @@
|
||||
use <../sweep.scad>;
|
||||
|
||||
module sf_cylinder(levels, radius, thickness, depth, invert = false, convexity = 1) {
|
||||
row_leng = len(levels[0]);
|
||||
a_step = 360 / row_leng;
|
||||
d_scale = (invert ? -depth : depth) / 255;
|
||||
or = thickness + (invert ? radius + depth : radius - depth);
|
||||
ir = radius;
|
||||
row_range = [0:row_leng - 1];
|
||||
|
||||
sections = [
|
||||
for(z = [0:len(levels) - 1])
|
||||
concat(
|
||||
[for(xi = row_range)
|
||||
let(
|
||||
r = or + levels[z][xi] * d_scale,
|
||||
a = xi * a_step
|
||||
)
|
||||
[r * cos(a), r * sin(a), -z + row_leng]
|
||||
],
|
||||
[for(xi = row_range)
|
||||
let(a = xi * a_step)
|
||||
[ir * cos(a), ir * sin(a), -z + row_leng]
|
||||
]
|
||||
)
|
||||
|
||||
];
|
||||
|
||||
sweep(sections, "HOLLOW");
|
||||
}
|
Reference in New Issue
Block a user