mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 21:58:27 +01:00
43 lines
872 B
OpenSCAD
43 lines
872 B
OpenSCAD
|
include <BOSL/constants.scad>
|
||
|
include <BOSL/transforms.scad>
|
||
|
include <BOSL/primitives.scad>
|
||
|
include <BOSL/beziers.scad>
|
||
|
|
||
|
module leaf(s) {
|
||
|
path = [
|
||
|
[0,0], [1.5,-1],
|
||
|
[2,1], [0,3], [-2,1],
|
||
|
[-1.5,-1], [0,0]
|
||
|
];
|
||
|
xrot(90)
|
||
|
linear_extrude_bezier(
|
||
|
scale_points(path, [s,s]/2),
|
||
|
height=0.02
|
||
|
);
|
||
|
}
|
||
|
|
||
|
module branches(minsize){
|
||
|
if($parent_size2.x>minsize) {
|
||
|
attach("top")
|
||
|
zrot(gaussian_rand(90,10))
|
||
|
zring(n=floor(log_rand(2,5,4)))
|
||
|
zrot(gaussian_rand(0,5))
|
||
|
yrot(gaussian_rand(30,5))
|
||
|
let(
|
||
|
sc = gaussian_rand(0.7,0.05),
|
||
|
s1 = $parent_size.z*sc,
|
||
|
s2 = $parent_size2.x
|
||
|
)
|
||
|
cylinder(d1=s2, d2=s2*sc, l=s1)
|
||
|
branches(minsize);
|
||
|
} else {
|
||
|
recolor("springgreen")
|
||
|
attach("top") zrot(90)
|
||
|
leaf(gaussian_rand(100,5));
|
||
|
}
|
||
|
}
|
||
|
recolor("lightgray") cylinder(d1=300, d2=250, l=1500) branches(5);
|
||
|
|
||
|
|
||
|
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|