1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-06 08:08:32 +01:00
dotSCAD/examples/tree.scad
2019-07-14 10:14:10 +08:00

38 lines
898 B
OpenSCAD

include <turtle/turtle3d.scad>;
include <line3d.scad>;
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
angleZ, angleX, width) {
if(leng > leng_limit) {
t2 = turtle3d("xu_move", t, leng);
line3d(
turtle3d("pt", t), turtle3d("pt", t2),
width);
tree(
turtle3d("zu_turn", t2, angleZ),
leng * leng_scale1, leng_scale1, leng_scale2, leng_limit,
angleZ, angleX,
width);
tree(
turtle3d("xu_turn", t2, angleX),
leng * leng_scale2, leng_scale1, leng_scale2, leng_limit,
angleZ, angleX,
width);
}
}
leng = 100;
leng_limit = 1;
leng_scale1 = 0.4;
leng_scale2 = 0.9;
angleZ = 60;
angleX = 135;
width = 2;
t = turtle3d("create");
tree(t, leng, leng_scale1, leng_scale2, leng_limit,
angleZ, angleX, width);