mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Fixed fractal_tree.scad for attachable() refactoring.
This commit is contained in:
parent
ab6f59867e
commit
97663dd6a3
2 changed files with 19 additions and 12 deletions
|
@ -15,27 +15,34 @@ module leaf(s) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module branches(minsize){
|
module branches(minsize, s1, s2){
|
||||||
if($parent_size2.x>minsize) {
|
if(s2>minsize) {
|
||||||
attach(TOP)
|
attach(TOP)
|
||||||
zrot(gaussian_rands(90,20)[0])
|
zrot(gaussian_rands(90,20)[0])
|
||||||
zrot_copies(n=floor(log_rands(2,5,4)[0]))
|
zrot_copies(n=floor(log_rands(2,5,4)[0]))
|
||||||
zrot(gaussian_rands(0,5)[0])
|
zrot(gaussian_rands(0,5)[0])
|
||||||
yrot(gaussian_rands(30,10)[0])
|
yrot(gaussian_rands(30,10)[0]) {
|
||||||
let(
|
sc = gaussian_rands(0.7,0.05)[0];
|
||||||
sc = gaussian_rands(0.7,0.05)[0],
|
cylinder(d1=s2, d2=s2*sc, l=s1)
|
||||||
s1 = $parent_size.z*sc,
|
branches(minsize, s1*sc, s2*sc);
|
||||||
s2 = $parent_size2.x
|
}
|
||||||
)
|
|
||||||
cylinder(d1=s2, d2=s2*sc, l=s1)
|
|
||||||
branches(minsize);
|
|
||||||
} else {
|
} else {
|
||||||
recolor("springgreen")
|
recolor("springgreen")
|
||||||
attach(TOP) zrot(90)
|
attach(TOP) zrot(90)
|
||||||
leaf(gaussian_rands(100,5)[0]);
|
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
|
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,177];
|
BOSL_VERSION = [2,0,178];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue