Generating random tree branch
I want to generate (an image of) a single branch of a tree (the "woody plant" kind). Maybe similar to this branch, or this one.
I need it to be interesting but simple, so just one branch, with a few turns, and only a few splits (where it changes from one limb into two). It should start with one fat branch a开发者_Python百科nd split off into a few thin branches. I am not worried about leaves, as I am thinking that leaves are quite a separate issue, so can be handled later.
Where should I start? What is involved in this?
Thanks
Absolutely the best/easiest way to go is Context Free fractal image generator.
Here's something to get you started (hit Render until you like it):
startshape TREE
rule TREE {
BRANCH {}
}
rule BRANCH {
NEXT {r -1}
}
rule BRANCH {
NEXT {r 1}
}
rule BRANCH .01 {
NEXT {r 45}
}
rule BRANCH .01 {
NEXT {r -45}
}
rule BRANCH .01 {
NEXT {r 30}
NEXT {r -30}
}
rule NEXT {
CIRCLE {}
BRANCH {y .3 s .996}
}
精彩评论