Somewhat more realistic than your traditional "tree fractal". I took my "intestine" code, took advantage of the 2-argument size function (upgrade to 1.1 needed I guess!) and changed it around to make this believable tree shape. Looks somewhat like sagebrush or a tumbleweed branch.
startshape REALTREE
rule REALTREE {
MOVE {}
}
//tweak sizes for length
rule MOVE {
STRIPE {}
MOVE { r 20 y .9 x -.15 s .9}
}
rule MOVE {
STRIPE {}
MOVE { r -20 y .9 x .15 s .9}
}
//tweak weight for density
rule MOVE 2 {
STRIPE {}
MOVE { r 20 y .9 x -.15 s .8}
MOVE { r -20 y .9 x .15 s .8}
}
rule STRIPE {
SQUARE {s .1 1}
CIRCLE { s .1 y .5 }
CIRCLE { s .1 y -.5 }
}
Where is it documented? I'm interested in learning all I can about the CFDG syntax as possible, and while it's nice to pick up things here and there on the forums, a formal reference would be great.
Well, I'm probably over-estimating the amount of things there are to learn about, but, for example, I recently came across code that involved a "skew" adjustment. I hadn't heard of this one before. So, right now, I know about:
size (one or two arguments, x and y scaling?)
brightness
skew (not exactly sure what it does)
rotation
x
y
I also know that rules can be in the form of:
rule NAME chance {
}
Where chance is an optional numerical argument from 0 to 100 that specifies the chance that this rule, as opposed to another identically-named, will be chosen. Is there more to the "rule" declaration than this, for instance?
I think that's it. skew and relative sizing were just added this week, which is why they aren't in the examples yet. As soon as colors and blending are added, we'll come up with good examples and I'll finalize a tutorial.
A couple other things:
1. you can include files with the include directive.
2. putting a replacement in square brackets performs the transformations in order you list them instead of the "natural" order.
Example:
rule shape1 {
SQUARE {r 20 x 1 y 1}
}
puts a square at spot 1,1 rotated 20 degrees counter-clockwise
whereas
rule shape1 {
SQUARE [r 20 x 1 y 1]
}
rotates first, so the actual 1,1 placement is on a rotated coordinate plane. (relatively, of course!) A good example of where you wuold use this is drawing the face of a clock. It lets you avoid doing the trigonometry yourself or creating a separate rule to force the rotation first.