1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/examples/taiwan/golden_taiwan.scad
2021-06-21 08:52:53 +08:00

59 lines
1.5 KiB
OpenSCAD

use <shape_taiwan.scad>;
use <golden_spiral.scad>;
use <golden_spiral_extrude.scad>;
use <bezier_curve.scad>;
use <util/reverse.scad>;
use <surface/sf_splines.scad>;
use <surface/sf_solidify.scad>;
// smaller values are better
taiwan_fineness = 5;
// smaller values are better
wave_fineness = 0.05;
module golden_taiwan(taiwan_fineness, wave_fineness) {
module taiwan() {
mirror_taiwan = reverse([for(pt = shape_taiwan(15)) [pt[0] * -1, pt[1]]]);
translate([127.5, 42.5, 83]) golden_spiral_extrude(
mirror_taiwan,
from = 1,
to = 10,
point_distance = taiwan_fineness,
scale = 10
);
}
module wave() {
t_step = wave_fineness;
thickness = 100;
ctrl_pts = [
[[0, 0, 20], [60, 0, -35], [90, 0, 60], [200, 0, 5]],
[[0, 50, 30], [100, 60, -25], [120, 50, 120], [200, 50, 5]],
[[0, 100, 0], [60, 120, 35], [90, 100, 60], [200, 100, 45]],
[[0, 123, 0], [60, 123, -35], [90, 123, 60], [200, 123, 45]]
];
bezier = function(points) bezier_curve(t_step, points);
g = sf_splines(ctrl_pts, bezier);
bottom = [
for(y = [0:len(g) - 1])
[
for(x = [0:len(g[0]) - 1])
let(p = g[y][x])
[p[0], p[1], -10]
]
];
sf_solidify(g, bottom);
}
taiwan();
wave();
}
golden_taiwan(taiwan_fineness, wave_fineness);