You are not logged in or registered. Please login or register to use the full functionality of this board...
SIGN IN Join Our Community For FREE


Mira classic
05-01-2017, 05:15 PM (This post was last modified: 05-11-2017 12:23 AM by Waltersmind.)
Post: #1
 (Print Post)
Mira classic
Code Snippet: [Select]
'Mira.bas for QB64 Fork (B+=MGA) 2017-05-01 from:
'Mira.bas for SmallBASIC 0.12.8 [B+=MGA] update 2017-02-20

''update  Mira fractals from SmallBASIC
'' Martin Latter
'' Converted to SB from my old 1992 version in Archimedes BASIC
'' - SB and modern computers thankfully plot a bit faster.

'In most Mira all the interesting stuff happens immediately.

'This code will stay with one display until you press a key

RANDOMIZE TIMER

CONST xmax = 1200, ymax = 700
CONST xc = xmax / 2
CONST yc = ymax / 2
CONST dots = 10000 'for one round on Mira

SCREEN _NEWIMAGE(xmax, ymax, 32)
_TITLE "Mira fractal classic translated to QB64 Fork  by bplus"

DIM ca(INT(dots / 100)) AS _UNSIGNED LONG 'for color array
DIM a, b, c, x, y, z, j AS DOUBLE 'fractal calcs
DIM xp, yp, red, green, blue AS INTEGER 'screen x, y and color r, g, b

WHILE 1
    'set round
    a = RND
    b = RND * .008 + .993 'originally held const .9998
    c = 2 - 2 * a
    x = 0
    j = 0
    y = RND * 12 + .1

    'set palette (originally only 6 colors)
    FOR pc = 0 TO INT(dots / 100)
        red = INT(RND * 2) * (RND * 195 + 60)
        green = INT(RND * 2) * (RND * 195 + 60)
        blue = INT(RND * 2) * (RND * 195 + 60)
        ca(pc) = _RGB(red, green, blue)
    NEXT

    'the outer loop here waits for keypress to move out to new mira
    COLOR _RGB(0, 255, 255)
    PRINT "Start: a = "; a; "   b = "; b; "  Use the spacebar to toggle next random screen scene..."
    WHILE _KEYHIT <> 32
        _LIMIT 60
        FOR i = 0 TO dots
            z = x
            x = b * y + j
            j = a * x + c * (x ^ 2) / (1 + x ^ 2)
            y = j - z
            xp = (x * 20) + xc
            yp = (y * 20) + yc
            COLOR ca(INT(i / 100))
            PSET (xp, yp)
        NEXT
        _DISPLAY
    WEND
    CLS
WEND

Martin Latter original author, could this be same Martin as Walter's fractals?

Might be interesting to compare modifications from different evolutions.

   

   

   

B += _
Find all posts by this user
Like Post
The following 2 users Like bplus's post:
Aurel, Waltersmind (Admin)
05-10-2017, 07:10 PM
Post: #2
 (Print Post)
RE: Mira classic
These Fractals are great. Always enjoyed fractals. One gripe... Your fractals are just too efficient!! I'm used to seeing the fractal 'develop' before my eyes... create the mystique; the awe; the wonderment... Now it's just press the key and it's there...

Nah. It's not really a gripe. It's my age showing... I'm just used to fractals being slow because I'm used to them running on archaic machines... Great job. What's next? A 3D Mandelbrot clone? Oooo... Mandelbrots...

J

May your journey be free of incident.

Live long and prosper.
Find all posts by this user
Like Post
The following 1 user Likes johnno56's post:
bplus
05-10-2017, 09:39 PM (This post was last modified: 05-12-2017 12:31 AM by figosdev.)
Post: #3
 (Print Post)
RE: Mira classic
Find all posts by this user
Like Post
The following 1 user Likes figosdev's post:
bplus
05-10-2017, 10:11 PM
Post: #4
 (Print Post)
RE: Mira classic
OK I will try something (in SB first) see what happens.

B += _
Find all posts by this user
Like Post
05-11-2017, 01:40 AM
Post: #5
 (Print Post)
RE: Mira classic
I really enjoyed the Mira graphical demo so much that I started playing around with. I add lines to connect the dots and I started using alpha transparency in the colors. It really made for some spectacular images then. Here's the source code first.

Code Snippet: [Select]
'Mira.bas for QB64 Fork (B+=MGA) 2017-05-01 from:
'Mira.bas for SmallBASIC 0.12.8 [B+=MGA] update 2017-02-20

''update  Mira fractals from SmallBASIC
'' Martin Latter
'' Converted to SB from my old 1992 version in Archimedes BASIC
'' - SB and modern computers thankfully plot a bit faster.

'In most Mira all the interesting stuff happens immediately.

'This code will stay with one display until you press a key

RANDOMIZE TIMER

CONST xmax = 800, ymax = 600
CONST xc = xmax / 2
CONST yc = ymax / 2
CONST dots = 10000 'for one round on Mira

SCREEN _NEWIMAGE(xmax, ymax, 32)
_TITLE "Mira fractal classic translated to QB64 Fork  by bplus"

DIM ca(INT(dots / 100)) AS _UNSIGNED LONG 'for color array
DIM a, b, c, x, y, z, j AS DOUBLE 'fractal calcs
DIM xp, yp, red, green, blue AS INTEGER 'screen x, y and color r, g, b

WHILE 1
   'set round
   a = RND
   b = RND * .008 + .993 'originally held const .9998
   c = 2 - 2 * a
   x = 0
   j = 0
   y = RND * 12 + .1

   'set palette (originally only 6 colors)
   FOR pc = 0 TO INT(dots / 100)
       red = INT(RND * 2) * (RND * 195 + 60)
       green = INT(RND * 2) * (RND * 195 + 60)
       blue = INT(RND * 2) * (RND * 195 + 60)
       ca(pc) = _RGBA(red, green, blue, 30)
   NEXT

   'the outer loop here waits for keypress to move out to new mira
   COLOR _RGB(0, 255, 255)
   PRINT "Start: a = "; a; "   b = "; b; "  Use the spacebar to toggle next random screen scene..."

   WHILE _KEYHIT <> 32
       _LIMIT 60
       FOR i = 0 TO dots
           z = x
           x = b * y + j
           j = a * x + c * (x ^ 2) / (1 + x ^ 2)
           y = j - z
           xp = (x * 20) + xc
           yp = (y * 20) + yc
           COLOR ca(INT(i / 100))
           'PSET (xp, yp)
           size = RND * 1
           'LINE (xp - size, yp - size)-(xp + size, yp + size), ca(INT(i / 100)), BF
           IF i = 0 THEN
               PSET (xp, yp)
           ELSE
               LINE -(xp, yp)
           END IF
       NEXT
       _DISPLAY
   WEND
   CLS
WEND


There were so many wonderful patterns that came from the demo that I had a very hard time picking the ones I really wanted to share the most.

   
   
   
   
   
   
   

My goal is to bring joy, excitement, fun and education to all computer programming hobbyists, tinkerers, and amateurs. I also enjoy helping and working with those who aspire at becoming masters of their craft.
Find all posts by this user
Like Post
05-11-2017, 02:06 AM (This post was last modified: 05-12-2017 12:32 AM by figosdev.)
Post: #6
 (Print Post)
RE: Mira classic
Find all posts by this user
Like Post
05-11-2017, 03:35 AM
Post: #7
 (Print Post)
RE: Mira classic
Version in Ruben, written few years back...

Code Snippet: [Select]
'original code written in Creative Basic
defn i ,n ,red ,green ,blue
defn ww ,wh ,dots ,xpos ,ypos
defn repeat ,random
defn a ,b ,c ,x ,y ,z
defn j ,xfocus ,yfocus
defn rr ,gg ,bb , count
set ww = 800
set wh = 600
'open window
wform 0,0,ww,wh,#MMS,0,"CB Fractal Patterns"
wcolor 0,0,0
set xfocus = ww * 0.47
set yfocus = wh * 0.45

label repeat
   set count = count + 1
wColor 0,0,0
set random = RAND(5)

FOR repeat,1,random
' set up some random starting positions ..
    set a = RND(2.0)
    set b = 0.9998
    set c = 2 - 2 * a
    
    set dots = 2000
    
    set x = 0
    set j = 0
    set y = RND(1.0)*12 + 0.246

' calculate and draw the points ..
    FOR i,0,dots
        
        set z = x
        set x = b * y + j
        set j = a * x + c * (x*x)/(1 + x*x)
        set y = j - z
        set xpos = x*20 + xfocus
        set ypos = y*20 + yfocus
        
        set rr = RAND(255)
        set gg = RAND(255)
        set bb = RAND(255)
        txColor rr,gg,bb
        circle xpos,ypos,z
    NEXT i
    
NEXT repeat

if count,<,5
jump repeat
endif

repeat=0
random=0
dots=0

basicPro forum:
http://basicpro.mipropia.com/smf/index.php
EU Radioboard forum:
http://euradioboard.createmybb3.com/index.php
AurelSoft main site:
http://aurelsoft.ucoz.com
Find all posts by this user
Like Post
05-11-2017, 02:03 PM (This post was last modified: 05-11-2017 02:04 PM by bplus.)
Post: #8
 (Print Post)
RE: Mira classic
Hi Walter,

I got same as you last night in SB, then I applied some Plasma Treatment and tried Circles, Rectangles, ...

Are we allowed to post in dialect outside QB64 fork after the original QB64 fork code is posted?

It would be fun, once past the QB64 fork introduction to compare with others dialects.

But BEWARE, major disputes can erupt when friendly competition forgets to be friendly.

We also have to remember that posting in dialects that people can't or won't run is just plain teasing. ;-))

Hi Aurel!

B += _
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - Exit
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Martin Fractals version four
QB64 Member Project - Color Triangles
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Basic Dithering
QB64 Member Project - Splatter
QB64 Member Project - Inside Moves
QB64 Member Project - Kings Court
QB64 Member Project - Blokus
QB64 Member Project - Spiro Roses
QB64 Member Project - Qubic
QB64 Member Project - Algeria Weather
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Point Blank
QB64 Member Project - Bowditch curve
QB64 Member Project - Dakapo
QB64 Member Project - Quarto
QB64 Member Project - Rotating Background
QB64 Member Project - 9 Board
QB64 Member Project - Overboard
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Rubix's Magic
QB64 Member Project - Amazon
QB64 Member Project - Color Rotating Text
QB64 Member Project - Line Thickness
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Isolation
QB64 Member Project - Score 4
QB64 Member Project - Domain
QB64 Member Project - RGB Color Wheel
QB64 Member Project - Othello
QB64 Member Project - Connect Four
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Sabotage
QB64 Member Project - Input
QB64 Member Project - Touche
QB64 Member Project - Dreamy Clock
QB64 Member Project - Foursight
QB64 Member Project - Swirl
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Pivet version one
QB64 Member Project - Martin Fractals version one
QB64 Member Project - ARB Checkers
QB64 Member Project - Pivot version two
QB64 Member Project - OpenGL Triangles