Little Fractale Generator with source :)

Blitz3D Forums/Blitz3D Programming/Little Fractale Generator with source :)

Filax(Posted 2003) [#1]
With source code ... Use BCF Gui 2.0

DOWNLOAD :

http://www.cemporia.org/%7Eeddy/click/clic.php3?url=http://perso.wanadoo.fr/blitz3dfr/mesprojets/mandela.zip

If you have some improvement, share it :)





CyBeRGoth(Posted 2003) [#2]
Cool I love mandelbrot fractals, it renders pretty fast too :)


Filax(Posted 2003) [#3]
Reload it ! i have include some fractal test in the zip !


AbbaRue(Posted 2003) [#4]
If you had the program render every 64th point then the center point between what is rendered and so on until the full image is rendered then it would look like LightBrite.
Also as it is being rendered at any time allow zooming, before it is finished. That way you don't have to wait for the image to finish to further zoom in on an interesting area. Lastly allow one to backup to a previous view again so they can explore other areas without starting from the begining again.
These were ideas I had for a mandelbrot explorer I once started writing but never finished on my old Amiga.
Most mandelbrot programs always start at the top and move slowly down the page. And this always irratated me, having to wait until the entire image was drawn before continuing.
Drawing every 64th dot fills the screen 64 times faster.
And you get enough detail to know what area to zoom in on farther without waiting for the entire screen to finish.
I used a lookup table for the spacing of the dots. couldn't find a formula to do it. Because you don't want to draw the same dots twice.
It went something like this.
every 64th
step 32
every 64th
step 16
every 32th
step 8
every 16th
etc...
I think that was the table.
Anyway you can calculate a mandelbrot from any spot in the
set so it can even be made to fade in randomly.
Anything is better than rendering from top to bottom one pixel at a time.
Just a suggestion for anyone wanting to exparament some more.


CyberHeater(Posted 2003) [#5]
Cool. Much quicker then I remember on my old Amiga :)


Ice9(Posted 2003) [#6]
very nice mandelbrot explorer.
But I bottomed out in pixelation :(


Filax(Posted 2003) [#7]
If you have an idea for increase precision ... ?


Ziltch(Posted 2003) [#8]
I like you program.

This mod seems to speed it up a bit.
I have changed the Proc_RenderMandel() so it is Locking the buffer and using writepixelfast. It also doesnt then need to convert the colors.

Replace Proc_RenderMandel() with this code
Function Proc_RenderMandel()
	
	For i =0 To PalSize-1
		Read  Colour
		Col(I)=Colour
	Next
	
	xscale#=X_Side#/Float(xmax) 
	yscale#=Y_Side#/Float(ymax) 
 LockBuffer ImageBuffer (RenderView)

	For y=0 To ymax  Step Precision
		For x=0 To xmax Step Precision
			cx#=Float(x)*xscale#+Left_Side# 
			cy#=Float(y)*yscale#+Top_Side# 
			
			zx#=0
			zy#=0 
			
			ColorCounter=0
			CurrentColor=0

			While (zx#*zx#+zy#*zy#<4 And colorcounter+ScaleColor<MaxColor) 
				tempx#=zx#*zx#-zy#*zy#+cx#
				zy#=2*zx#*zy#+cy#
				zx#=tempx# 
				colorcounter=colorcounter+1
			Wend

			CurrentColor=colorcounter+ScaleColor Mod MaxColor

		;	SetBuffer ImageBuffer (RenderView)
		;	ConvertARGB(Col(CurrentColor))
		 ;Plot x,y
		 writepixelfast x,y,col(CurrentColor),ImageBuffer (RenderView)
 ;  SetBuffer BackBuffer()

			; -----------------------------
			; Gestion de 'l'interface
			; -----------------------------
			If BCF_TestButton(StopMandel)  Then
				BCF_ChangeGaugeValue(Gauge01,0)
				unLockBuffer ImageBuffer (RenderView)
				Return
			EndIf

			If BCF_TestButton(ZoomMandel)  Then
				BCF_ChangeGaugeValue(Gauge01,0)
				unLockBuffer ImageBuffer (RenderView)
				Proc_ZoomMandel
			EndIf

			; ---------------------------------
			; On quitte le programme
			; ---------------------------------
			If BCF_TestButton(QuitMandel)  Or  KeyHit(1)  Then
			 unLockBuffer ImageBuffer (RenderView)
				ClearWorld
				End
			EndIf
		Next 
  unLockBuffer ImageBuffer (RenderView)
		; -----------------------------------
		; Gauge et affichage image
		; -----------------------------------
		BCF_ChangeGaugeValue(Gauge01,y)
	;	RenderWorld
  cls
		DrawImage RenderView,0,0

		; -------------------------
		; Gestion de la BCF
		; -------------------------
		BCF_RenderBCF()
	
		Flip
	Next

	BCF_ChangeGaugeValue(Gauge01,0)
End Function



Filax(Posted 2003) [#9]
thx :)