2020-01-28 09:46:29 +08:00
|
|
|
use <line3d.scad>;
|
|
|
|
use <turtle/t3d.scad>;
|
2019-09-29 10:20:40 +08:00
|
|
|
|
2019-07-14 10:10:29 +08:00
|
|
|
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
|
|
|
angleZ, angleX, width) {
|
|
|
|
if(leng > leng_limit) {
|
2019-09-29 10:20:40 +08:00
|
|
|
t2 = t3d(t, "xforward", leng = leng);
|
2019-07-14 10:10:29 +08:00
|
|
|
|
2019-07-14 10:14:10 +08:00
|
|
|
line3d(
|
2019-09-29 10:20:40 +08:00
|
|
|
t3d(t, "point"), t3d(t2, "point"),
|
2019-07-14 10:10:29 +08:00
|
|
|
width);
|
|
|
|
|
|
|
|
tree(
|
2019-09-29 10:20:40 +08:00
|
|
|
t3d(t2, "zturn", angle = angleZ),
|
2019-07-14 10:10:29 +08:00
|
|
|
leng * leng_scale1, leng_scale1, leng_scale2, leng_limit,
|
|
|
|
angleZ, angleX,
|
|
|
|
width);
|
|
|
|
|
|
|
|
tree(
|
2019-09-29 10:20:40 +08:00
|
|
|
t3d(t2, "xturn", angle = angleX),
|
2019-07-14 10:10:29 +08:00
|
|
|
leng * leng_scale2, leng_scale1, leng_scale2, leng_limit,
|
|
|
|
angleZ, angleX,
|
|
|
|
width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-29 10:20:40 +08:00
|
|
|
leng = 20;
|
2019-07-14 10:10:29 +08:00
|
|
|
leng_limit = 1;
|
|
|
|
leng_scale1 = 0.4;
|
|
|
|
leng_scale2 = 0.9;
|
|
|
|
angleZ = 60;
|
|
|
|
angleX = 135;
|
|
|
|
width = 2;
|
|
|
|
|
2019-09-29 14:17:06 +08:00
|
|
|
t = t3d(point = [0, 0, 0]);
|
2019-07-14 10:10:29 +08:00
|
|
|
|
|
|
|
tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
|
|
|
angleZ, angleX, width);
|