## News:

*NEW* Current Version on STEAM16.793

Webchat:
Visit the chat

## Factal Trees

#### Kitty Hello

Well, how about drawing some nice 3D Trees with leaves and so on? Here's the basic framework needed:

Code (glbasic) Select
`// --------------------------------- //// Project:// Start: Monday, March 29, 2004// IDE Version: 1.40327// rule = â€œl [ + l ] l [ - l] lâ€ [Jürgens Hartmut, Peitgen Heinz-Otto, Saupe Dietmar://                                Fraktale - eine neue Sprache für komplexe Strukturen,//                                Spektrum der Wissenschaft (9/1989), p.62.] with// l = line// + = +28.58 degrees// - = -28.58 degrees// [ = start of a branch// ] = end of a branch    NewBranch(200,200,0, 0, -90, 0, 10) SHOWSCREEN MOUSEWAIT// ------------------------------------------------------------- //// -=#  NEWBRANCH  #=-// ------------------------------------------------------------- //FUNCTION NewBranch: x, y, z, phi, psi, depth, maxdepthLOCAL ex, ey, ez, px, py, pz, lngth, ln_bottom, dphi, dpsiLOCAL n, nbranches, col lngth = 100/(1+depth) ln_bottom = lngth*COS(psi) nbranches = 2 ex = x + COS(phi)*ln_bottom ey = y + SIN(psi)*lngth ez = z + SIN(phi)*ln_bottom IF (depth FOR n=1 TO nbranches pos = n/(nbranches+1) px = x+(ex-x)*pos py = y+(ey-y)*pos pz = z+(ez-z)*pos dphi = phi + (RND(2)-1)*28.58 dpsi = psi + (RND(2)-1)*28.58 NewBranch(px, py, pz, dphi, dpsi, depth+1, maxdepth) NEXT ENDIF col = RGB(200 - 200*(depth/maxdepth), 64+128*(depth/maxdepth), 0) // Front DRAWLINE x, y, ex, ey, col // Left DRAWLINE z+120, y, ez+120, ey, col // Top DRAWLINE x, z+320, ex, ez+320, colENDFUNCTION`

And an image:

#### goomoo

Cool!

Thanks for share!

Nice!

#### Kitty Hello

The SDK should have a folder Projects/LindenmayerTrees which has a 3D Version of that. You can use X_SAVEOBJ to save the tree to a file then...