1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-21 06:29:46 +01:00

refactored

This commit is contained in:
Justin Lin 2017-06-01 09:19:12 +08:00
parent 67b25a0ab0
commit c10443641e

View File

@ -17,15 +17,20 @@ include <__private__/__half_trapezium.scad>;
module rounded_cylinder(radius, h, round_r, convexity = 2, center = false) {
r_corners = __half_trapezium(radius, h, round_r);
shape_pts = concat(
[[0, -h/2]],
r_corners,
[[0, h/2]]
);
center_pt = center ? [0, 0, 0] : [0, 0, h/2];
translate(center ? [0, 0, 0] : [0, 0, h/2])
rotate(180)
rotate_extrude(convexity = convexity)
polygon(
concat(
[[0, -h/2]],
r_corners,
[[0, h/2]]
)
);
}
polygon(shape_pts);
}