1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/examples/voxel_vase.scad

41 lines
952 B
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <bezier_curve.scad>
use <voxel/vx_polyline.scad>
use <voxel/vx_cylinder.scad>
2019-07-02 16:17:48 +08:00
x1 = 5;
x2 = 20;
x3 = 8;
thickness = 1;
module pixel_vase(x1, x2, x3, thickness) {
p0 = [x1, 0, 0];
p1 = [10, 0, 4];
p2 = [x2, 0, 8];
p3 = [3, 0, 20];
p4 = [x3, 0, 30];
rounded_points = [for(pt = bezier_curve(0.1,
[p0, p1, p2, p3, p4]
)) [round(pt[0]), round(pt[1]), round(pt[2])]];
2020-05-20 16:54:02 +08:00
vx_path = vx_polyline(rounded_points);
leng = len(vx_path);
2019-07-02 16:17:48 +08:00
2020-05-20 16:54:02 +08:00
for(p = vx_cylinder(vx_path[0][0], 1, true)) {
2019-09-26 08:53:47 +08:00
linear_extrude(1)
translate([p[0], p[1]])
square(1.1, center = true);
2019-07-02 16:17:48 +08:00
}
for(i = [0:leng - 1]) {
2020-05-20 16:54:02 +08:00
r = vx_path[i][0];
for(p = vx_cylinder(r, 1, thickness = thickness)) {
2019-07-02 16:17:48 +08:00
translate([0, 0, i])
2019-09-26 08:53:47 +08:00
linear_extrude(1)
translate([p[0], p[1]])
square(1.1, center = true);
2019-07-02 16:17:48 +08:00
}
}
}
pixel_vase(x1, x2, x3, thickness);