I did write one in PostScript once, I think I lost the code though :(
Tied the printer up for about 15 minutes sitting there processing it :D
Printable View
I did write one in PostScript once, I think I lost the code though :(
Tied the printer up for about 15 minutes sitting there processing it :D
sorry guys mad a mistake here:
i forgot to include the scaleheigt property. the correct number of average oscillations should therefore be:Quote:
scalewidth = 4 : stepsize = 0.0009 : iteration limit = 64
taking average for the lp when the code exits the do-loop statement to approximately = 30
so therefore on average there are a total of:
(4/0.0009) * 30 iterations per fractal drawn.
this is = 133,333.3333333 iterations.
(4/0.0009)^2 * 30 = 592592592.592 iterations per fractal
ok i see what you mean. how different is it printing pictures through vb compared to printing files? couldn't the printer object be used with your colors array to map the fractal to the printer buffer? i really don't know much about this.... let me try and do a google search and see if i can learn anything.Quote:
A program that generated an image directly to the printer and functioned at the printer pixel level could create a much better image than that shown on the monitor.
I think I saw a clue suggesting that the PSet Method was applicable to a printer. If so, it should be easy to plagiarize the Picture Box code and paint directly to the printer.
Perhaps a search of the Graphics forum or a question there might provide some ideas. Will do that when I get my Fractal application working. I am not happy with the Julia Set code.
BTW: Just discovered that I own a never used book: Fractal Creations, copyright 1993. It came with executable code on a 3.5 Diskette and source code on a CD. The images in the book are incredible, and the software must be remarkable. It does everything you would want to do with a Fractal generator. I was busy with a job, prowling piano bars, tennis, skiing, and a lot of other activities and never used this software.
Unfortunately the book is oriented to the software and does not provide useful algorithms for writing a VB program.
To run that software, I might hunt down an ISA graphics card and resurrect DOS on a currently unused system. Some time ago, I tried to run some excellent DOS graphics software on my system. With a modern Graphics Control card, it would not use more than 16 colors. A lot of the old DOS software included builtin drivers for many of the Graphics Controllers available back then, making the software unuseable on a modern system.
hey Guv,
i'm helping setup a school website. Theres just me and this other guy working on it so i'm very very busy,i hardly get time to open up vb let alone work on the app.
the bright side of this though is that i have the oppurtunity to learn HTML,CSS,ASP,VbScript and the MacroMedia range of apps!!
it's very interesting and exciting work.
so hows your app going? have you managed to print directly to the device yet? keep us updated!
TheAlchemist: Good luck with your School WebSite project. So far, I not even tried to learn how to do WebSites and related programming.
Julia Sets are causing me some problems, primarily related to the coloring algorithm. I also have a bug in the code which is supposed to generate a black boundary. I am not sure how to handle Fatou Dust Sets.
I might do some research into coloring the interior of the Mandelbrot Set. I have been wondering about the points which do not go to infinity. What do they do? I guess that some find an attractor, while others oscillate among two or more points. Do any visit an infinite number of points inside the set?
I think that the Mandelbrot Boundary can be determined by doing reverse Mandelbrot iterations starting from points outside the set. One coloring scheme could be to pick a solid color for the interior, black for the border, and the usual method for the exterior.
I am currently modifying the code to provide for more than one coloring algorithm. This requires saving iterations tallies in an array rather than color numbers. My current fast repaint code works with an array of color numbers, which can be reassigned prior to repainting. This method cannot accommodate a change in the basic TallyToColor assignment algorithm.
hey Guv,
thanks, the design is going pretty well.
what black boundary? points in the julia set? the Fatou dust sets that are generated through my app are pretty harsh to the eyes as the background contains a majority of just one color.Quote:
Julia Sets are causing me some problems, primarily related to the coloring algorithm. I also have a bug in the code which is supposed to generate a black boundary. I am not sure how to handle Fatou Dust Sets.
hmm...pretty interesing questions for consideration. i have also been trying to figure out the logic for coloring the interior of the mandelbrot set. imagine the hue change effect that appears normally on the outside in the interior. with a higher value of n in z=z^n+lambda, it would be possible to create very pretty flowers to impress a special girl!Quote:
I might do some research into coloring the interior of the Mandelbrot Set. I have been wondering about the points which do not go to infinity. What do they do? I guess that some find an attractor, while others oscillate among two or more points. Do any visit an infinite number of points inside the set?
this is why i have been thinking about this!
i have written a small utility to calculate the number of occurences of a particualr value in a file. e.g. suppose the contents of the file are:
3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,4,4,4,4,3,3,3
the utility will return:
3 count:13
4 count:10
5 count:6
i wrote it to analyze the loop count/iteration values for the mandelbrot set so that i can come up with a good coloring algorithm. just one problem though. you have seen from above how many iterations my app gpes through. this means that storing the iteration count in an array would quickly flood memory and cause an overflow. for this reason i was using a buffer to write the count to file t regular intervals. now: the code works fine for the fist 10,000 value then it just doesnt execute! the graphic continues drawing normally. i tried inputting a fixed length constant string in a file at the same intervals and that generated a huge file just as it is expected to. this is an example of the write to file code that i used:
VB Code:
'This code produces a file of max size 51-54kb PSet (x,y), lblcolor(lp) 'where lp is the loop count If Len(temp) >= 100 Then write #1, temp temp = "" 'remove this line and it saves the same string over 'and over again just as expected. ' i.e. it doesnt execute the else bit. ' file size =huge Else temp = temp & lp End If
do you know why this is happening? i open the file when the sub is entered and close it before leaving the sub.
TheAlchemist: Glad your Website is going well.
I see no reason why your code should stop working after about 10,000 values. Could the file handle get reassigned somehow? How did you decide to use #1 for the file handle? Is File Handle the correct term? I usually use code like the following.I do not understand why you think an array of iteration counts would not fit into memory. When I work at 800X600, my Picture Box is 588X485, which is 285,180 pixels. I store one integer iteration count per pixel, requiring less than 600,000 bytes. My monitor only goes to 1280X1024, but even at 1600X1200, you would have less than 2,000,000 pixels, and require less than 4,000,000 bytes to store an integer for each pixel.VB Code:
On Error GoTo BadPut GrvtyFileNumber = FreeFile ‘Get an unused File Handle. Open File_name For Binary Access Write Lock Read Write _ As GrvtyFileNumber Put GrvtyFileNumber, 1, FileStamp
My application uses 4-12 colors, controllable by the user. For some fractals, less colors result in an esthetically more pleasing graphic. I provide three coloring algorithms: Equal intervals, Equal logarithm scaled intervals, and what I call Cyclic (ColorNumber = Count Mod LastColor). I save the iteration counts in a 2D array, and can repaint after changing the colors and/or the algorithm. So far, the Cyclic algorithm has produced terrible graphics.
From what I have seen so far, the application is improved a lot by providing the ability to vary the number of colors used and by the ability to shuffle the colors. The equal intervals and log-scaled intervals also seem to be worthwhile options.
A Julia Set with the constant from the main part of the Mandelbrot Set has a simple closed curve as a boundary. If the constant is (0, 0), the Julia Set is a circle of radius one centered on the origin.
Other choices from inside the main part of the Mandelbrot Set result in Julia Sets with a fractal boundary, which is a simple closed curve. Like the special case circle, there is an attractor inside as well as the attractor at infinity. For other choices inside the Mandelbrot Set and not in the main part, the boundary is not a simple closed curve and there can be more than one finite attractor. I do not know if there is an upper bound on the number of attractors.
For constants outside the mandelbrot Set, Julia Sets are disconnected regions or Fatou Dust, or maybe tighted packed Fatou Dust instead of disconnected regions. I am not sure about this.
I am unhappy with my Julia Set coloring algorithms. I think the graphic would be improved if I could draw the boundary, but so far efforts to do so have failed.
hey Guv,
you're right. the right colouring algorithms are vital to get nice images. i havent had time to explore the loop count values yet, i will try and do it this weekend. managed to print directly to that printer yet?
damn i missed my centtenial post!!!!!!! ahhhh i stoped paying attention to the post count and whoop it went right past me!!!
TheAlchemist: I have not tried to figure out or research drawing directly to the printer in Pixel mode. When I solve a few other problems, I think I will try searching the Graphics Forum. If no luck with search, I will post a question there or in the General VB forum.
Something I read implied that reversing the Julia Set iteration would generate border points. After a bit of experimentation, it seems to me that the reverse iteration finds attractors on the border, but is not useful for generating the entire border. I have seen published Julia Set images with fractal borders and interior colorings which are esthetically pleasing, so there must be known methods. I have not yet found algorithms for either Julia Set colorings or borders.
I might try reverse engineering some DOS code (either C or Assembler) which I have on a CD. I previously mentioned a DOS application from the early nineties which generates marvelous fractals and provides recipes for them. Unfortunately the recipes relate to parameters for the DOS Software. I do not think this software will produce good images on a modern system, but perhaps I should try it. Most of the good DOS graphics software used special drivers which do not work with PCI or AGP Graphics controllers.
Sorry you missed your centennial post.
BTW: I celebrated my billionth second and my Gigasecond (10243) many many years ago, but forgot to celebrate my 2 billionth and 2 Gigasecond events, which occurred a few years before I retired.
All young computer gurus should celebrate their billionth second and Gigasecond events. Billionth second occurs about 251-252 days after 31st birthday. Gigasecond occurs about 9 days after 34th birthday (assuming 365.242 days in a year).
hey Guv,
GigaSecond!! alright, something cool to look forward to! i wonder how many second old i am now!? let me get computing.
Hey Guv,
I have adapted your style for mapping a rectangle in the complex plane to a picture box. Everything works better!!!! and its much quicker.
I just have a small problem with my zoom function though. You may remeber that i allow the user to draw a rectangle over the area that he wishes to zoom in on.(this is perfectly suited to the 'mapping style')
well most of the function works fine, just that it maps the wrong area!(not the one the user selected.) i an't seem to find the bug. I'm working on it though!
check this page out:
http://www.geocities.com/SiliconVall...tml#mandelbrot
thanks for the link mate. some pretty useful links on that page!
hey! you should make your program calculate the correct stepsize to get it draw all pixels and not too many pixels, cus then its really slow!
do it like this:
Private StepSizeX As Single
Private StepSizeY As Single
StepSizeX = picFractal.ScaleWidth / (picFractal.Width / Screen.TwipsPerPixelX)
StepSizeY = picFractal.ScaleHeight / (picFractal.Height / Screen.TwipsPerPixelY)
you should also use SetPixelV, or GetDibBits to draw faster!
here's an example of a simplified version using SetPixelV.
ask in the games and gfx forum if you want to know any faster ways of drawing.
Cyborg: The bottleneck in drawing fractal images is the computations. The drawing part does not take much time.
TheAlchemist: Your zoom problem is likely due to an incorrect conversion from pixel position to virtual XY Coordinates. I had similar problems with my conversions in both directions. When zooming in, I force the Picture Box to stay the same size and shape.
Attached is a zip file containing my current Fractal application. Perhaps you might like to try it. I have deliberately given no instructions for using the application. I want to know if it is easy to hack.
Why not attach your current application to your next post? I would like to play with it a bit.
I am very unhappy with the Julia Set images. I have not found a way to create a black boundary, and the coloring is esthetically lousy. I suspect there are some bugs for certain types of Julia Sets.
I have been zooming in on the Mandelbrot Set and comparing with some images from a book. I cannot find the images shown in the book and do not know what the problem is. Perhaps, there is a computational problem, since I am zooming in pretty far. The book images might have been made using extra precision arithmetic. Perhaps I am zooming in to the wrong place. Perhaps my color algorithms are too different from those used for the book images. I do not think there is anything wrong with the program logic since many images seem like true Mandelbrot images, but there is always the possibility of a bug or some strange logic that only manifests itself under special conditions.
I would like to improve the coloring algorithms for the Mandelbrot Set. They are not as esthetically pleasing as some I have seen in various books. Anything I do for the Mandelbrot Set might also help the Julia Set images. Perhaps I should provide several sets of colors.
Cyborg
i have changed my stepping to exactly what you suggested by building on the code Guv provided. But thanks anyway. I am going to have a look at your example. Will post on it later. thanks for the additional ideas and links!
Guv
My problem is with coloring algorithms too! i have found a nice red and black one but thats about it! i will post my app tomorrow, i don't have it here. I really wanted to see your app!its not attached though. Have you checked the link Cyborg provided? Its got links to some pretty informative sites.
hmm julia sets are quite a handful! i just want to sort my zoom problem first. I once wrote a graphing app, in it I wrote a method to ind the position of the origin relative to the dimesions of the picture box. I think this is just what i need to fix my zoom problem. I also don't change the dimesions of the picture box.
When i started coding these sets i still didn't know for sure what i was going to take for my major in uni. I have now been admitted into an Applied Maths major! this app has been perfect for begining my dynamical systems experience!
will post on your app soon.
Forgot to attach application to last post. Here it is.
I know! Thats why it shouldn't waste time on the drawing - Do all speedups possible!Quote:
Originally posted by Guv
Cyborg: The bottleneck in drawing fractal images is the computations. The drawing part does not take much time.
check this out!
i've made a renderer in c++ and a gui in vb...in the gui you can zoom and change all other suff....then click render and the c++ program will render the image for you in just a second! really fast! then it loads back into vb!
tell me if you want the source!
here it is
what? where?Quote:
Originally posted by TheAlchemist
here it is
here is another version using a dll file that i made in c++.
it's fast and easy, with no known bugs.
damn it didn't attach! give me a few minutes.
Cyborg:
i can't seem to use your app(the first c++ one), it says some files are missing. I did not note a very great rise in performance from the alterations you made to my code. It may be because it was still using the {Step 0.0001} thingy. In a few minute check out the new version.
BTW can you show me how to use the GetDIBits function. Thanks.
Guv:
I still haven't manged to check your app. Please give me a few more hours. Thanks.
here's an example using getdibbits...its still very slow, but that's because its vb..
(the zoom function is a bit buggy)
hey guys,
sorry i still haven't posted! my floppies always seem to die on me just when i need to attach! this is the same reason i still haven't gotten to see your code Guv-no way to get it to a vb enabled computer.
Im working on it.
i managed to make my program alot faster (thanks to Agent and Jon for some help with this). so now there's realtime animation fly-through, bmp and jpeg file support.
i managed to do this by making all the calculations and drawings in the c++ dll file, so now it works almost like BitBlt, only it calcs what to draw.
Cyborg: Your latest version was impressive.
Thanks alot! :)Quote:
Originally posted by Guv
Cyborg: Your latest version was impressive.
Do you have any ideas for improvements?
Cyborg: My application is entirely VB, resulting in rendering extremely slowly compared to your application. The difference in speed surprises me. I assume that the computations take most of the time, and I would expect VB code to be more efficient for raw computing. I use a maximum of 200 to 1000 iterations per pixel.
Your code seems to store all the values in an array and then draw the image from the array. Might this technique make the process faster? I compute for a single pixel, store in an array (for fast repaint), and paint the pixel
Your animation controls are too slow due to taking small increments and rendering at each change in size or position. It is interesting to home in on extremely small virtual areas, and your method is too slow. Decreasing the number of iterations seems to help.
An algorithm which is initialized to take 25% jumps seems about correct. This allows homing in exponentially. If user changes direction, use half the previous percentage. User can adjust to the area of interest fairly easily and quickly.
I start with a factor of .75 for zooming in and 1.25 for zooming out. If user zooms in then out, the zoom out is 1.125, and the next zoom in would be .9375 The left/right & up/down movements are handled similarly. When the user stops zooming and moving, my application resets to the original percentages.
ok, ill try to make the animation a bit better...in fact, i dont like it the way it is either.
in the latest version i send all the variables (such as rmin, rmax, etc) to the dll.
then the dll creates a DC and a one dimensional array that can hold all pixels.
then i compute all pixels and store the color values in the array.
then i use SetDibBits to draw them all to the DC.
then i BitBlt the DC back to the one in VB.
i was making it draw directly to the DC in VB fist but then i experienced some problems with it, so i created a new one and used BitBlt to draw it back.
there is probably some ways to make it all work faster.
for example when zooming out i could stretchblt the image smaller and only render the parts thats new. (same when scrolling sideways)
Guv
I have been playing around with your application. I particularly like the n'th root fractals. There seems to be a problme with your julia sets. All the sets produced (at least for all the valus of C that i have tried) are variations of the C = 0+0i fractal. They are basically very round with a slight black border.
I am leaving for university in a few days so i am very busy and don't have as much time as i would like to have to study your application. Have I mentioned yet that it is great!!! It is!
I find your zooming a bit restricting with the rectangle size being fixed, but i understand it is neccesary to prevent distortion of the selected area when mapped to the picture boxes' dimensions.
I have still chosen to leave my zooming functions intact. After studying your colouring algorithms a bit i have discovered that the kind of colouring that i am using is a variation of cyclic colouring! phew i finally have a name for it. The equal interval scheme is not very aesthetically pleasing or open to interesting exploration by zooming.
I haven't had time to carefully read the links Cyborg provided but have a strong feeling that my knowledge of fractals will substantially increase after i have. I also haven't had time to look at Cyborgs' app yet.
I like the way you have used DeMoivre's theorem/notation for complex numbers to find the roots of the newton iteration functions. I am working on a similar scheme for my app... but with a variation- I don't think i will be using angles.
try this colour scheme for your app:
VB Code:
Dim idx As Integer Dim r As Integer r = For idx = 0 To 11 lblColor(idx).Backcolor = r r = r + 1016 Next idx
im not sure if this is the right code.. i will confirm and get back to you. In the mean time just use this. It should produce different hues of red fading into black...produces very aesthetically pleasing fractals. BTW i sorted out my zooming problem. Your tip was spot on.
Cyborg
I hope you understand my predicament cyborg- i appreciate your contribution to this thread.
hey guys, here it is finnaly, took some time because i was busy getting settled into college
try the last version of my app! :)
its really fast!
Hey guys am back!
I figured out a cool way to make nice color schemes(if you remember that was once of the problems i was working on)
VB Code:
Dim idx As Integer Dim x As Integer Dim r As Integer idx = 255 For r = 0 to 11 lblColor(r).BackColor = RGB(x,x,idx) idx = idx - 20 x = x + 20 Next r
would generat nice hues of blue(try it out by simply replacing the above code in the SetCols Subroutine in my project)
looks nice!
have you tried UltraFractal?
here's the link: http://www.ultrafractal.com/
you might get some ideas from it...but its really advanced!
hey i just downloaded ultra fractal, wow! you were right in saying its really complicated! im going to try and figure out small parts of it and try and intergrate them in to my own app. I might just buy it after the evaluation expires, unless u know of a crack. ;)
A long time ago, my father told me that if you had a machine that only had one function, you turned it on and it did that funciton. If you had a device capable of doing two functions, you had to turn it on and choose a button or a switch setting to chose which function you desired. If you had a device that could do thousands of functions, you might not be able to figure out how to get it to do anything.
UltraFractal & Fractint are incredible applications. Both make my fractal application look sad, but I wonder how many people can use either effectively without a lot of study. I have Fracint for DOS, but most DOS graphics programs are ineffective on modern systems due to graphic card compatibility problems. I downloaded Fractint for Windows, which I think is freeware.
I am thinking about building a DOS system using an old graphics card. I still have a lot of very fascinating DOS software, and think I can find a suitable graphics card somewhere (likely on ebay).
cracks are illegal, but if you dont care: www.cracks.am
(just had to mention it)
Guv: i agree. its a bit too complicated.