| |
|
|
p.specht
|
{$cleq}
Window Title "Mandelbrot-Menge"
' In starker Anlehnung on the program of Julian Schmid and Paul Glatz
' Reine (D) demonstration 2013-09 by P. woodpecker, Wien. Use solely at your own risk!
Windowstyle 24
Window 400,300
' Window (%maxx-640)/2,(%maxy-480)/2 - 640,480
' Window 0,0-%maxx,%maxy-42
declare cxmin!,cxmax!,cymin!,cymax!,iter&,tm&,ans&,zoom!,i&
zoom!=0.7
whileloop 10:i&=&loop
zoom!=zoom!*1.3333
CXMin!=-2.2 /zoom!
CXMax!= 1.2 /zoom!
CYMin!=-1.5 /zoom!
CYMax!= 1.5 /zoom!
iter&=128
tm&=&gettickcount
ans&=Mandel(cxmin!,cxmax!,cymin!,cymax!,iter&)
tm&=&gettickcount-tm&
locate 1,1:print stature$("#0.0000 sec ",tm&/1000);
waitinput 10
case (%key=27) or (%key=2):end
Endwhile
waitinput 60000
end
nProc Mandel
parameters cxmin!,cxmax!,cymin!,cymax!,iter&
Declare CX!,CY!,x!,x2!,y!,tmp!,LX&
Declare LY&,IC&,col&,w&,hddc&,xd!,yd!
w&=width(hwnd)
hddc& = ~GetWindowDC( %hWnd )
xd! = CXMax! - CXMin!
yd! = CYMax! - CYMin!
whileloop 0,w&
LX&=&loop
CX! = CXMin!
' f!=float(l&), Float2Long simply l&=long(f!)
tmp!= float(LX&) / float(w&)
cx!=cx! + tmp! * xd!
LY&=0
whileloop 0,height(%hwnd)
LY&=&loop
CY!=CYMax!-(float(LY&)/float(height(%hwnd)))*yd!
IC&=0
x!=0
x2!=0
y!=0
whileloop Iter&,0,-1
IC& = &loop
x2! = sqr(x!) - sqr(y!) + cx!
y! = 2.0 * x! * y!
y! = y! + cy!
x! = x2!
If (sqr(x!)+sqr(y!)) > 4.0
Break
EndIf
EndWhile
col&=IC&*ic&*ic&*ic&*ic&
'col&=RGB( long((float(LX&)/float(width(%hwnd))) )*256, long(float(LX&)/float(width(%hwnd)))*256, IC& | (IC& << 8))
'col& = RGB(IC&,IC&,IC& | (IC& << 8) ) 'sw
SetPixel(%hdc,LX&,LY&,col&)
Endwhile
Endwhile
return w&
endproc
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/09/21 ▲ |
|
|
|