English
Source / code snippets

Mandelbrot-crowd: Apfelmännchen - with xpse speed

 

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  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

567 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie