It is well known, that as since fractals possess self-similarity on scaling, therefore they can be made by iterations of scaling transformations. In Figure 1 it is shown how the famous Koch's snowflake is obtained by repetition of simple transformations: scaling, rotations and translations.
The initial segment 1 is shrunk three times, then three small copies are translated upward and two of them rotated by +-60 degrees. Then this procedure is applied again to the entire curve 2 to get the next curve 3 and so on.
Unlike the well known L-systems fractals, this algorithm does not need a rather complicated string parser and 3D turtle for its realization. It uses "natural" 3D operations: scaling, rotations and translations and it can be used with any "3D engine" (VRML, Java3D or Java1 applets). Unfortunately, there is no such "built in" 3D engine in present-day browsers.
Initial branch 1 is shrunk two times, then three small copies are translated upward and two of them rotated by +-45 degrees. Then this procedure is applied again to the entire branch 2 to get the next branch 3 and so on. To get a more sophisticated example we need branches of two types.
Figure 3. A more sophisticated tree. VRML tree.
We shrink "branch" 1 and translate three copies again but we add a new branch (lower thick line in Figure 3) each iteration. You can see script for this tree below.
Transform{ translation 0 1 0 children
DEF s1 Transform{ scale .5 .5 .5 children[
Transform{ translation 0 1 0 children[
DEF s0 Shape{ # leaf
appearance Appearance{ material Material{ diffuseColor 0 1 0}}
geometry IndexedFaceSet{
coord Coordinate{ point[0 0 0,.1 .5 0,0 1 0,-.1 .5 0]}
coordIndex[0 1 2 3] } }
]}
Transform{ translation 0 1 0 rotation 0 0 1 .7 children USE s0}
Transform{ translation 0 1 0 rotation 0 0 1 -.7 children USE s0}
DEF b1 Shape{ # branch
appearance Appearance{
material Material{ emissiveColor 0 0 0}}
geometry IndexedLineSet{
coord Coordinate{ point[0 0 0,0 1 0]} coordIndex[0 1]}}
]}
}
Transform{ translation 0 1 0 rotation 0 0 1 .7 children USE s1}
Transform{ translation 0 1 0 rotation 0 0 1 -.7 children USE s1}
USE b1
To avoid repetitions and to use the script for any number of
iterations it can be realized as a cycle in JavaScript.
Different 3D plants are obtained by scaling, rotations and translations:
We can use cones for trunk and PixelTexture to make more realistic plant. Random disturbance can be used easily too. "Remote" birch with random crown. One of fractal polyheda, shown in Figure 4, is obtained by scaling and translations transformations too.