Mandelbrot-Menge
Übersicht

BloodredBetreff: Mandelbrot-Menge |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hier meine implementierung des apfelmännchens. ich wollte eigentlich eine
zoomfunktion einbauen, aber leider wird die berechnung mit zunehmender vergrößerung immer langsamer. Code: [AUSKLAPPEN] Const resx = 1024 Const resy = 768 Const max_it = 100 Const R = 10 Global zoom# = 300 Function plot_complex(re#, im#, col) Color col, col, col Plot resx/2 + re# * zoom, resy/2 - im# * zoom End Function Function iteration(x#,y#) it = 0 a# = 0 b# = 0 Repeat t1# = a# t2# = b# a# = t1#^2 - t2#^2 + x# b# = 2 * t1# * t2# + y# q_b# = a#^2 + b#^2 it = it + 1 Until (q_b# > R) Or (it > max_it) If it > max_it Then c = 0 Else c = it Return c End Function Graphics resx, resy, 32, 1 y1# = -resy/(2*zoom) y2# = resy/(2*zoom) x1# = -resx/(2*zoom) x2# = resx/(2*zoom) cx# = 0 cy# = 0 y# = y1# x# = x1# dxy# = 1/zoom# If dxy# > 0 Then While y# < y2# x# = x# + dxy# If x# > x2# Then x# = x1# y# = y# + dxy# End If cc = iteration(x#,y#) plot_complex(x#,y#,cc*3.5) Wend End If Repeat Until KeyHit(1) |
||
Hot-BitSieger des B2D Retro Wettbewerb / Aug 04 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hoi.
Plot ist langsam. Nimm WritePixel(fast). Toni |
||
... ..... .i.. ...
*** Sieger des BB-Gameboy-Contest 2004 Sieger des Blitzbaster 2D-Minigolf-Contest 2005 *** |
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] Const resx = 1024 Const resy = 768 Const max_it = 100 Const R = 10 Global zoom# = 300 Function plot_complex(re#, im#, col) farbe=col Shl 16 + col Shl 8 + col WritePixelFast resx/2 + re# * zoom, resy/2 - im# * zoom, farbe ;Color col,col,col ;Plot resx/2 + re# * zoom, resy/2 - im# * zoom End Function Function iteration(x#,y#) it = 0 a# = 0 b# = 0 Repeat t1# = a# t2# = b# a# = t1#^2 - t2#^2 + x# b# = 2 * t1# * t2# + y# q_b# = a#^2 + b#^2 it = it + 1 Until (q_b# > R) Or (it > max_it) If it > max_it Then c = 0 Else c = it Return c End Function Graphics resx, resy, 32, 1 SetBuffer BackBuffer() y1# = -resy/(2*zoom) y2# = resy/(2*zoom) x1# = -resx/(2*zoom) x2# = resx/(2*zoom) cx# = 0 cy# = 0 y# = y1# x# = x1# dxy# = 1/zoom# If dxy# > 0 Then time1=MilliSecs() LockBuffer BackBuffer() While y# < y2# x# = x# + dxy# If x# > x2# Then x# = x1# y# = y# + dxy# End If cc = iteration(x#,y#) plot_complex(x#,y#,cc*3.5) Wend UnlockBuffer BackBuffer() time2=MilliSecs() Flip RuntimeError (time2-time1) End If Repeat Until KeyHit(1) ;21166 ;writepixelfast frontbufer ;25226 ;plot frontbuffer ;21410 ;Plot backbuffer ;21228 ;writepixelfast backbuffer Garnet schlecht, sieht gut aus. IMurDOOM |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
Bloodred |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
deine modifikation funktioniert bei mir nicht...
aber das problem liegt hier eindeutig nicht in der geschwindigkeit der grafikausgabe. ich hab mich noch nicht ernsthaft damit beschäftigt und kann nur erahnen, woran das liegt. die idee war folgende: man müsste einen ausschnitt markieren können, der dann auf den ganzen bildschirm vergrößert wird, so dass man immer tiefer in die strukturen hineinzoomen kann. aber die rechenzeit nimmt mit der vergrößerung überproportional zu ![]() |
||
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Da wird es wohl außer vorberechnungen keine schnellere Lösung geben.
IMurDOOM |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
![]() |
Triton |
![]() Antworten mit Zitat ![]() |
---|---|---|
Bloodred hat Folgendes geschrieben: aber die rechenzeit nimmt mit der vergrößerung überproportional zu
![]() Warum? Ich denke Fraktale sind nur ein sich ständig in sich selbst wiederholendes Muster. Also bräuchte man es eigebtlich nur einmal berechnen. |
||
Coding: silizium-net.de | Portfolio: Triton.ch.vu |
Bloodred |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Triton hat Folgendes geschrieben: Warum? Ich denke Fraktale sind nur ein sich ständig in sich selbst wiederholendes Muster.
Also bräuchte man es eigebtlich nur einmal berechnen. nein, das ist so nicht richtig. soweit ich weiß, haben komplexe fraktale auf allen ebenen selbstähnliche muster, die sich aber niemals wiederholen. also wäre es doch faszinierend, mal in den rand der mandelbrot-menge zu zoomen. Edit: ich könnte mich auch irren, bin kein mathematiker. |
||
Hot-BitSieger des B2D Retro Wettbewerb / Aug 04 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hoi.
Da es nicht sein kann, daß da einfach irgendwer daher kommt, und seinen Code da zeigt, muß ich natürlich dieses Forum hier vertreten ![]() Code: [AUSKLAPPEN] Graphics 800,600
SetBuffer BackBuffer() SeedRnd MilliSecs() While Not KeyHit(1) col1=Rand(4,16):col2=Rand(4,16):col3=Rand(4,16):limit=Rand(3,16):scale#=Float(Rnd(0.002,0.005)) cx#=Float(Rnd(0.0001,0.01)):cy#=Float(Rnd(0.0001,0.01)) Cls For x = -400 To 399 For y = -300 To 299 ax#=Float(cx+x*scale):ay#=Float(cy+y*scale) a1#=Float(ax) b1#=Float(ay) lp=0 Repeat lp=lp+1 a2#=Float(a1*a1-b1*b1+ax) b2#=Float(2*a1*b1+ay) a1#=Float(a2) b1#=Float(b2) Until (lp>255) Or ((a1*a1)+(b1*b1)>limit) If lp>255 Goto dahin Color lp*col1,lp*col2,lp*col3 rgb=(lp*col1)*$10000+(lp*col2)*$100+(lp*col3) WritePixel x+470,y+300,rgb .dahin:Next Next Color 255,192,0:Text 620,560,"(c) 2005 HOT-BIT" Flip Wend End Meinungen sind willkommen... Toni |
||
... ..... .i.. ...
*** Sieger des BB-Gameboy-Contest 2004 Sieger des Blitzbaster 2D-Minigolf-Contest 2005 *** |
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hübsch hübsch Hot Bit
IMurDOOM |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
Hot-BitSieger des B2D Retro Wettbewerb / Aug 04 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hoi.
Ich weiß ![]() Trotzdem frage ich mich, warum mein Code so viel schneller ist... Toni |
||
... ..... .i.. ...
*** Sieger des BB-Gameboy-Contest 2004 Sieger des Blitzbaster 2D-Minigolf-Contest 2005 *** |
morszeck |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hier noch um den Faktor 2-5* schneller:
Code: [AUSKLAPPEN] Graphics 800,600,32,2
SetBuffer BackBuffer() SeedRnd MilliSecs() While Not KeyHit(1) ts = MilliSecs() col1=Rand(4,16) col2=Rand(4,16) col3=Rand(4,16) limit=Rand(3,16) scale#=Rnd(0.002,0.005) cx#=Rnd(0.0001,0.01) cy#=Rnd(0.0001,0.01) Cls LockBuffer() For x = -399 To 399 ;For y = -299 To 299 For y = 0 To 299 ax#=cx+x*scale ay#=cy+y*scale a1#=ax b1#=ay lp=0 Repeat lp=lp+1 a2#=a1*a1-b1*b1+ax b2#=2.0*a1*b1+ay a1#=a2 b1#=b2 Until (lp>255) Or ((a1*a1)+(b1*b1)>limit) If lp<=255 Then rgb=(lp*col1)*$10000+(lp*col2)*$100+(lp*col3) WritePixelFast x+470,y+300,rgb WritePixelFast x+470,300-y,rgb EndIf Next Next UnlockBuffer() Color 255,192,0 Text 580,560,"(c) 2005 HOT-BIT "+ (MilliSecs()-ts) +" ms" Flip Wend End |
||
Hot-BitSieger des B2D Retro Wettbewerb / Aug 04 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi.
lol, danke, für die Beschleunigung. Aber es war schon spät, und ich mußte ins Bett. Sehr schön gemacht ! Toni |
||
... ..... .i.. ...
*** Sieger des BB-Gameboy-Contest 2004 Sieger des Blitzbaster 2D-Minigolf-Contest 2005 *** |
![]() |
stfighter01 |
![]() Antworten mit Zitat ![]() |
---|---|---|
hab mal code für blitzmax geschrieben
http://home.arcor.de/ddfsdf.df...talgen.zip hat ne zoom u. eine preview funktion. ausserdem kann man auch das julia fraktal damit inspizieren ![]() mfg stfighter |
||
Denken hilft! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group