Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36

Thread: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

  1. #21
    Member sblank's Avatar
    Join Date
    Feb 2010
    Location
    Wayne City, Illinois
    Posts
    80
    Rep Power
    23

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    Wow!!

    Fantastic Charles... I'll second Eros and Kent. This is amazing stuff and I can see that I need to learn Oxygen... or I need some Oxygen?

    Question (hopefully not too naive): You have a maxit range of from 20...100. Is this a hard limit (byte size)? I'm wondering about trying to zoom in and provide higher resolution?

    I really like the complex operator definitions (macros? functions?). It looks like it would be possible to add additional functions for trig, exp, log, etc. It might be possible to create a fractal explorer or toolkit?

    Just curious and getting ahead of myself, as usual.

    Cheers,

    Stan

  2. #22

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    Thank you all!

    Well here are some keyboard controls for navigation:

    Arrow keys: move around

    PageUp: zoom in x2
    PageDown: zoom out x.5
    Home: Increase resolution (slower)
    End: Decrease resolution (faster)

    Esc: quit




    @Stan: The resolution control works by increasing/reducing the maxit variable. Thanks for suggesting it.

    To up performance I reverted to assembler for the core calculation. It makes a big difference in speed by eliminating a lot of memory accesses.

    Would anybody like to add a coordinate/zoom factor display ?

    Charles
    Attached Files Attached Files

  3. #23
    Member sblank's Avatar
    Join Date
    Feb 2010
    Location
    Wayne City, Illinois
    Posts
    80
    Rep Power
    23

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    This is getting better and better... again, fantastic work, Charles!

    Question: Is maxit limited to the range 20...100 or is there a limitation to the resolution? It seems as though once I reach 100, I can't increase the resolution on the screen at all. The M-Set does take proportionally longer to computer, but the resolution seems to stay constant after 100.

    I may be missing something, though...

    Cheers... and great job!

    Stan

    Quote Originally Posted by Charles Pegge
    Thank you all!

    Well here are some keyboard controls for navigation:

    Arrow keys: move around

    PageUp: zoom in x2
    PageDown: zoom out x.5
    Home: Increase resolution (slower)
    End: Decrease resolution (faster)

    Esc: quit




    @Stan: The resolution control works by increasing/reducing the maxit variable. Thanks for suggesting it.

    To up performance I reverted to assembler for the core calculation. It makes a big difference in speed by eliminating a lot of memory accesses.

    Would anybody like to add a coordinate/zoom factor display ?

    Charles

  4. #24
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    That is fantastic demo Charles!
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #25
    Member sblank's Avatar
    Join Date
    Feb 2010
    Location
    Wayne City, Illinois
    Posts
    80
    Rep Power
    23

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    Hi Charles,

    I WAS missing something... maxit works exactly as you intended. As I zoom into the M-Set and then increase maxit, I can see the resolution increase with each press of 'Home'

    My fault on the misunderstanding... and great job with the program!

    Cheers,

    Stan

  6. #26
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    That is really great Charles. Zooming in and scrolling around I saw so many cool textures in there. Thanks for a cool demo!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  7. #27

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set


    I've added different shading schemes. Number Keys 1..5
    Try number 3 for the Hendrix option


    [color=blue]Number keys: 1..5 shading scheme

    Arrow keys: move around

    PageUp: zoom in x2
    PageDown: zoom out x.5
    Home: Increase resolution (slower)
    End: Decrease resolution (faster)

    Esc: quit


    Attached Files Attached Files

  8. #28

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    is this syntax braching forward/backward ?
    (
    cmp ecx,3 : jz exit
    fmul st(0),st(0)
    )
    
    the same as ?
    cmp ecx,3
    jz exit
    fmul st(0),st(0)
    exit:
    
    (Sorry about my bad English.)

  9. #29

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set


    Yes Joshy. This enables block structured programming in Asm. You can exit or repeat the blocks which are nestable.

    (
    ...
    dec ecx : jnz repeat
    )

    (
    cmp al,32
    jnz exit
    ...
    )


    Another feature is that any label defined inside the brackets is invisible to any code on the outside.
    So you can have local labelling.

    Also, you may use several assembler instructions on one line - just like Basic

    Charles

  10. #30
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set

    my 5 cent for today

    as my notebook is old and not very fast, I have changed x+y arrange values to 0.015.
    and for iComplex: z = iComplex_Sin(z).

    some examples before I tested something like

    z = iComplex_Mul(z,z) '-----------> z*p or z+p or c*p doesn't work. out of range!
    and after rendering the scene about 45 per cent I've got error message that I am out of range so rendering was aborted.

    [code=thinbasic]' Empty GUI script created on 03-04-2010 16:47:52 by (ThinAIR)

    ' Example: Section 7.7 (page 222-224), Explorations with the Mandlebrot Set

    ' From Stan Blank's Book:
    ' "Python Programming in OpenGL
    ' "A Graphical Approach to Programming

    ' Converted by Stan Blank, this version is slightly downgraded in detail by Petr Schreiber
    ' Using the Predator-Prey framework by Michael Clease
    ' Last modified: February 28, 2010

    ' thinBasic does not use GLUT, we use instead tbgl
    Uses "TBGL"

    ' insert Eros Olmi's new iComplex module
    Uses "iComplex"


    Function TBMain()

    ' Handle for our window
    Local hWnd As DWord
    Local Width As Long
    Local Height As Long
    Local n As Long
    Local x,y, zz As Double

    ' Declare iComplex variables
    Local z, c As tComplex

    '# Initial values of width And height
    width = 680
    height = 500
    '
    ' Create and show window
    hWnd = TBGL_CreateWindowEx("Frankos_Mandelbrot Set", Width, Height, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX Or %TBGL_WS_DONTSIZE)
    TBGL_ShowWindow

    ' -- Set background from default black to white
    TBGL_BackColor(0,0,0)

    ' -- Init OpenGl, like gluOrtho2D in example code
    TBGL_RenderMatrix2D( -2, -1.5, 1, 1.5 )

    TBGL_PointSize 1

    ' Resets status of all keys
    TBGL_ResetKeyState()

    Local percent As Double
    Local p,v As Double

    ' -- Create new GBuffer
    Local gbMandelbrot As DWord = TBGL_GBufferCreate(%TBGL_POINTS, %TBGL_2D)
    Local MandelbrotIndex As Long
    Local MandelbrotVertex(160000) As tbgl_tVector2f ' -- TYPE from TBGL
    Local MandelbrotColor (320000) As tbgl_tRGB ' -- TYPE from TBGL
    p = -0.001*Cos(GetTickCount/5000)*100

    ' -- Fill it with data
    For x = -2 To 1 Step 0.015

    For y = -1.5 To 1.5 Step 0.015
    Incr MandelbrotIndex
    Incr MandelbrotColor(MandelbrotIndex).r

    ' Set complex points
    c = iComplex_Set(x,y)
    z = iComplex_Set(x,y)
    v = iComplex_Set(x,y)
    n = 0

    For n = 1 To 50
    ' Equation is z = z*z + c
    z = iComplex_Mul(z,z) '-----------> z*p or z+p or c*p doesn't work. out of range!
    z = iComplex_Add(z,c)
    z = iComplex_Sin(z)
    'z = iComplex_sub(z,v)

    ' Distance from origin to complex point
    zz = iComplex_Abs(z)

    ' if distance is > 2.0, then point is NOT in the M-Set
    ' so plot it... the M-Set will be black
    If zz > 2.0 Then
    MandelbrotColor (MandelbrotIndex).R = 455 '--> ? problem
    MandelbrotVertex(MandelbrotIndex).x = x
    MandelbrotVertex(MandelbrotIndex).y = y
    End If
    Next
    Next

    ' -- Write status
    percent = (x-(-2))/3*100
    TBGL_SetWindowTitle(hWnd, Format$(percent, "#.00")+"%, rendering full detail")
    DoEvents

    ' -- Dynamically say to TBGL where the data are, this is just pointer gymnastics, no copy
    TBGL_GBufferDefineFromArray(gbMandelbrot, %TBGL_DYNAMIC, MandelbrotIndex, MandelbrotVertex(1), MandelbrotColor(1))

    ' -- Redraw
    TBGL_ClearFrame
    TBGL_GBufferRender(gbMandelbrot)
    TBGL_DrawFrame

    ' -- Escape sooner?
    If TBGL_GetWindowKeyOnce(hWnd, %VK_ESCAPE) Then Exit For

    Next

    TBGL_SetWindowTitle(hWnd, "Behold - the Mandlebrot! ")

    ' Main loop
    While TBGL_IsWindow(hWnd)

    TBGL_ClearFrame

    TBGL_GBufferRender(gbMandelbrot)

    TBGL_DrawFrame

    If TBGL_GetWindowKeyOnce(hWnd, %VK_ESCAPE) Then Exit While

    Wend

    TBGL_DestroyWindow

    End Function
    [/code]

    I haven't tested at all charles examples. Will do that next time.

    thanks to all for this great mandelbrot experiences by iComplex module examples. frank
    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. 3D Mandelbrot Set
    By zak in forum General
    Replies: 11
    Last Post: 29-11-2010, 06:40
  2. Benoit Mandelbrot, RIP
    By LanceGary in forum Shout Box Area
    Replies: 6
    Last Post: 05-11-2010, 03:35

Members who have read this thread: 35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •