Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Moving Fractal Tree
Author Message
fishtastic

Posted: Fri Feb 15, 2008 3:58 pm   Post subject: Moving Fractal Tree

Not as good as i expected. but I wanted to do this

 Turing: var tree : collection of     record         l : int         a : real         c : int         t : int         b : int         son : array 1 .. 6 of pointer to tree     end record const d := 5 % mess around with this var const t := Rand.Int (2, 3) % and this var var s := -0.2 var acc := 0.01 var col : array 1 .. d of int var roots : array 1 .. t of pointer to tree var x : array 1 .. t of int proc initialize (var t : pointer to tree, c, depth : int)     new tree, t     if c <= depth then         t -> l := floor ((1.6 ** (depth - c) * Rand.Int (15, 30)))         t -> a := Rand.Int (-60, 60) + 90         if c = 1 then             t -> a := 90         end if         t -> c := c         t -> t := (depth - c) * 3         t -> b := Rand.Int (depth - c, 6)         for i : 1 .. t -> b             initialize (t -> son (i), c + 1, depth)         end for     end if end initialize proc draw (t : pointer to tree, c, depth, x, y : int)     if c <= depth then         if c = depth then             Draw.FillOval (x, y, 4, 4, col (t -> c))         else             var dx := round (cosd (t -> a) * t -> l)             var dy := round (sind (t -> a) * t -> l)             Draw.ThickLine (x, y, x + dx, y + dy, ceil (1.25 ** t -> t), col (t -> c))             for i : 1 .. t -> b                 draw (t -> son (i), c + 1, depth, x + dx, y + dy)             end for         end if     end if end draw proc move (t : pointer to tree, c, depth, a : real)     if c <= depth then         t -> a += a         for i : 1 .. t -> b             move (t -> son (i), c + 1, depth, a * 2)         end for     end if end move View.Set ("offscreenonly") colorback (102) for i : 1 .. d div 2     col (i) := RGB.AddColour (0.2 + 0.1 * i, 0.1 + 0.1 * i, 0) end for for i : d div 2 .. d     col (i) := RGB.AddColour (0.0, 0.1 * i, 0) end for for i : 1 .. t     initialize (roots (i), 1, d)     x (i) := Rand.Int (50, maxx - 50) end for loop     cls     for i : 1 .. t         draw (roots (i), 1, d, x (i), 0)         move (roots (i), 1, d, s)     end for     s += acc     if s > 0.2 or s < -0.2 then         acc := -acc     end if     View.Update end loop

Mackie

Posted: Fri Feb 15, 2008 4:29 pm   Post subject: RE:Moving Fractal Tree

O wow, that's awesome. I'm adding this to my lst of things to research/create.
SIXAXIS

Posted: Fri Feb 22, 2008 8:33 am   Post subject: Re: Moving Fractal Tree

Looks great. Reminds me a bit of the trees in Far Cry 2; they move in the wind and they can regenerate after a while.
DanielG

Posted: Sun Feb 24, 2008 5:28 pm   Post subject: RE:Moving Fractal Tree

Its not bad, but I think it is a little too slow
McKenzie

Posted: Sun Feb 24, 2008 7:51 pm   Post subject: Re: Moving Fractal Tree

The key is you're on the right track, now all that's left is to play with it until it looks the way you want it to. Trust me, I've drawn many, many fractal trees in Turing. Keep playing, you'll get it.
DaveAngus

Posted: Tue Mar 18, 2008 9:16 am   Post subject: RE:Moving Fractal Tree

This is pretty cool. I like it.

Posted: Thu Nov 21, 2019 10:45 pm   Post subject: RE:Moving Fractal Tree

How do i make a plain tree? Not moving
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 7 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: