Fixed fractal_tree.scad for attachable() refactoring.

This commit is contained in:
Revar Desmera 2020-03-09 21:16:26 -07:00
parent ab6f59867e
commit 97663dd6a3
2 changed files with 19 additions and 12 deletions

View file

@ -15,27 +15,34 @@ module leaf(s) {
);
}
module branches(minsize){
if($parent_size2.x>minsize) {
module branches(minsize, s1, s2){
if(s2>minsize) {
attach(TOP)
zrot(gaussian_rands(90,20)[0])
zrot_copies(n=floor(log_rands(2,5,4)[0]))
zrot(gaussian_rands(0,5)[0])
yrot(gaussian_rands(30,10)[0])
let(
sc = gaussian_rands(0.7,0.05)[0],
s1 = $parent_size.z*sc,
s2 = $parent_size2.x
)
cylinder(d1=s2, d2=s2*sc, l=s1)
branches(minsize);
yrot(gaussian_rands(30,10)[0]) {
sc = gaussian_rands(0.7,0.05)[0];
cylinder(d1=s2, d2=s2*sc, l=s1)
branches(minsize, s1*sc, s2*sc);
}
} else {
recolor("springgreen")
attach(TOP) zrot(90)
leaf(gaussian_rands(100,5)[0]);
}
}
recolor("lightgray") cylinder(d1=300, d2=250, l=1500) branches(10);
module tree(h, d, minsize) {
sc = gaussian_rands(0.7,0.05)[0];
recolor("lightgray") {
cylinder(d1=d, d2=d*sc, l=h) {
branches(minsize, h, d*sc);
}
}
}
tree(d=300, h=1500, minsize=10);
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View file

@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,177];
BOSL_VERSION = [2,0,178];
// Section: BOSL Library Version Functions