Re: Tiny fractal studio :-)
Posted: Mon Mar 15, 2010 3:41 pm
Ehm, in principle that is possible. But ... there is 2 "buts" :Thustrust wrote:You should try to get it to calculate and draw a maximum number of lines per frame so there's no lag and the detail can be as large as you want. Rather than doing all operations in a single "frame" which gets exponentially more computationally intensive, maybe you could just run through a set number of lines in each frame. That way the fractal would slowly draw itself and the program wouldn't hang.
Would that work?
1. Lets say fractal is drawn from some table fractal = {x1,y1,x2,y2,x3,y3,...}. After calculating next fractal stage - fractal table is erased and re-inserted all new fractal points (Now it is like that). To be able to do like you say, we should change that table dynamically, -> remove some points then add some points. This means that there will be needed :
- length_of_fractal_table number of deletes from fractal table
- inserts into fractal table must be performed not at the end of table, but everywhere (in start of table, somewhere in between of table, etc.)
These two things I suppose will extend total time needed for fractal calculation. (Requirement of deletes - certainly will extend computations. What about inserts not in the end of table - i don`t know, it may extend computation time also,- but generally will depend on How tables are implemented in Lua. This answer possibly knows Roberto Ierusalimschy, or we should check Lua core description or research Lua C++ source )
2. Lets just pretend that everyhing went fine - your proposal will just let us see *intermediate* calculation steps, but total time of fractal computation will not decrease. I think this is crucial. What user will do with unfinished intermediate fractal ? I mean that implementation of such thing will not give us any striking advantage. (Striking advantage would be if we manage to shorten total computation time, or lets say somehow add color effects on fractal
Good luck!