明确概念
Fractal: a rough or fragmented geometric shape that can be split into parts, each of which is a reduced-size copy of the whole.
Recursion: the repeated application of a rule to successive results.
明确功能
1.通过递归画一个雪花折叠图
2.通过递归画一个树状图
功能设计
类:Tree
属性:root, angle
方法:branch
伪代码
setup(){
}
draw(){
tree.branch();
}
class Tree{
定义属性
Tree(){}
定义方法
}
正式代码
见:
Processing/Fractals at master · JoeyQiang/Processing · GitHub
代码优化
1.随机角度,随机长度