Author Topic: Original IFS Fractals  (Read 2667 times)

0 Members and 1 Guest are viewing this topic.

Offline AndyA

  • Newbie
  • Posts: 73
Original IFS Fractals
« on: December 09, 2019, 12:32:08 am »
These are fractals that I've designed, so you  haven't seen them before, although some may look like others on the net.
All of them were designed in Apophysis https://sourceforge.net/projects/apophysis/files/latest/download
except for the 'QB64' IFS fractal.

'QB64' was designed using IFS Lab  https://www.nzeldes.com/Fractals/Fractals_core.htm
Both of the software packages are free downloads.

@Johnno56 and Bplus,
I hope these render better than the ones in SDL Basic, they're super fast on QB64!

On my machine all fractals except QB64 render in a millisecond or less!



QB64   (needs a steady hand so it doesn't look like a child drew it. Oh well...)
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'Designed in 'IFS Lab' by Nathan Zeldes     https://www.nzeldes.com/Fractals/Fractals_core.htm
  3. _TITLE "IFS QB64"
  4.  
  5. scaleX! = 850.0
  6. scaleY! = 1200.0
  7. offsetX% = -25
  8. offsetY% = -20
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 96)
  11. COLOR _RGB32(255, 255, 255)
  12.  
  13. FOR iter& = 0 TO 80000
  14.         CASE 0 TO .1106
  15.             nx! = 0.240 * lastX! + 0.005 * lastY! + 0.057
  16.             ny! = 0.002 * lastX! + 0.170 * lastY! + 0.087
  17.         CASE .1107 TO .1982
  18.             nx! = -0.002 * lastX! + 0.139 * lastY! + 0.066
  19.             ny! = -0.231 * lastX! + -0.008 * lastY! + 0.384
  20.         CASE .1983 TO .3092
  21.             nx! = 0.242 * lastX! + 0.005 * lastY! + 0.056
  22.             ny! = -.009 * lastX! + 0.168 * lastY! + 0.363
  23.         CASE .3093 TO .3238
  24.             nx! = 0.055 * lastX! + -0.047 * lastY! + 0.302
  25.             ny! = 0.052 * lastX! + 0.053 * lastY! + 0.384
  26.         CASE .3239 TO .41491
  27.             nx! = 0.003 * lastX! + 0.142 * lastY! + 0.343
  28.             ny! = -0.235 * lastX! + -0.005 * lastY! + 0.374
  29.         CASE .4150 TO .4377
  30.             nx! = 0.063 * lastX! + -.068 * lastY! + 0.445
  31.             ny! = 0.064 * lastX! + 0.065 * lastY! + 0.106
  32.         CASE .4378 TO .4640
  33.             nx! = 0.071 * lastX! + -.068 * lastY! + 0.438
  34.             ny! = 0.074 * lastX! + 0.065 * lastY! + 0.251
  35.         CASE .4641 TO .4842
  36.             nx! = 0.074 * lastX! + 0.003 * lastY! + 0.349
  37.             ny! = 0.000 * lastX! + 0.100 * lastY! + 0.096
  38.         CASE .4843 TO .5033
  39.             nx! = 0.075 * lastX! + -0.005 * lastY! + 0.351
  40.             ny! = 0.000 * lastX! + 0.094 * lastY! + 0.358
  41.         CASE .5034 TO .5837
  42.             nx! = 0.001 * lastX! + 0.131 * lastY! + 0.221
  43.             ny! = -0.226 * lastX! + -0.010 * lastY! + 0.374
  44.         CASE .5838 TO .6073
  45.             nx! = 0.071 * lastX! + 0.058 * lastY! + 0.394
  46.             ny! = -0.048 * lastX! + 0.083 * lastY! + 0.227
  47.         CASE .6074 TO .6280
  48.             nx! = 0.058 * lastX! + 0.066 * lastY! + 0.405
  49.             ny! = -0.033 * lastX! + 0.094 * lastY! + 0.355
  50.         CASE .6281 TO .7096
  51.             nx! = 0.058 * lastX! + 0.191 * lastY! + 0.540
  52.             ny! = -0.152 * lastX! + 0.018 * lastY! + 0.229
  53.         CASE .7097 TO .7481
  54.             nx! = 0.015 * lastX! + 0.099 * lastY! + 0.538
  55.             ny! = -0.140 * lastX! + 0.021 * lastY! + 0.353
  56.         CASE .7482 TO .7783
  57.             nx! = 0.119 * lastX! + 0.003 * lastY! + 0.575
  58.             ny! = 0.003 * lastX! + 0.094 * lastY! + 0.344
  59.         CASE .7784 TO .8416
  60.             nx! = 0.197 * lastX! + -0.034 * lastY! + 0.751
  61.             ny! = 0.000 * lastX! + 0.118 * lastY! + 0.199
  62.         CASE .8417 TO .8706
  63.             nx! = 0.117 * lastX! + -0.036 * lastY! + 0.607
  64.             ny! = 0.061 * lastX! + 0.073 * lastY! + 0.214
  65.         CASE .8707 TO .8819
  66.             nx! = 0.016 * lastX! + 0.071 * lastY! + 0.661
  67.             ny! = -0.051 * lastX! + 0.031 * lastY! + 0.343
  68.         CASE .8820 TO .9174
  69.             nx! = 0.043 * lastX! + 0.09 * lastY! + 0.759
  70.             ny! = -0.128 * lastX! + 0.034 * lastY! + 0.198
  71.         CASE .9175 TO .9499
  72.             nx! = 0.003 * lastX! + 0.095 * lastY! + 0.853
  73.             ny! = -0.125 * lastX! + 0.008 * lastY! + 0.206
  74.         CASE ELSE
  75.             nx! = 0.006 * lastX! + 0.123 * lastY! + 0.846
  76.             ny! = -0.149 * lastX! + 0.008 * lastY! + 0.387
  77.     END SELECT
  78.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  79.     lastX! = nx!
  80.     lastY! = ny!
  81.  

Moon Jelly
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap4-180109-001a
  3. _TITLE "IFS Moon Jelly"
  4.  
  5. scaleX! = 85.916
  6. scaleY! = 109.973
  7. offsetX% = 564
  8. offsetY% = 61
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 170)
  11. COLOR _RGB32(128, 240, 255, 64)
  12.  
  13. FOR iter& = 0 TO 1000000
  14.         CASE 0 TO .24
  15.             nx! = -.486478 * lastX! + -.886276 * lastY! + -2.09443
  16.             ny! = -.543314 * lastX! + .977109 * lastY! + -.609152
  17.         CASE .25 TO .49
  18.             nx! = .299017 * lastX! + .018083 * lastY! + -.881445
  19.             ny! = .079087 * lastX! + .396048 * lastY! + .208439
  20.         CASE .50 TO .74
  21.             nx! = .582294 * lastX! + -.618687 * lastY! + .854146
  22.             ny! = .32754 * lastX! + .315409 * lastY! + .8567
  23.         CASE ELSE
  24.             nx! = .585919 * lastX! + .019146 * lastY! + -1.30101
  25.             ny! = -.351028 * lastX! + .260532 * lastY! + .211793
  26.     END SELECT
  27.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  28.     lastX! = nx!
  29.     lastY! = ny!


Foot Print (closest description I could think of)
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3-180106-221
  3. _TITLE "IFS Foot Print"
  4.  
  5. scale! = 545.6813
  6. offsetX% = 144
  7. offsetY% = 355
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. CLS , _RGB32(224, 192, 120)
  10. COLOR _RGB32(160, 118, 96, 50)
  11.  
  12. FOR iter& = 0 TO 1000000
  13.         CASE 0 TO .177
  14.             nx! = -.256576 * lastX! + -.270262 * lastY! + .566841
  15.             ny! = -.211468 * lastX! + .270545 * lastY! + -.332541
  16.         CASE .178 TO .307
  17.             nx! = .19207 * lastX! + -.402232 * lastY! + .344923
  18.             ny! = -.256814 * lastX! + -.39666 * lastY! + .266384
  19.         CASE ELSE
  20.             nx! = .623372 * lastX! + .245593 * lastY! + .158646
  21.             ny! = -.188462 * lastX! + .908327 * lastY! + .075229
  22.     END SELECT
  23.     IF iter& > 20& THEN PSET (nx! * scale! + offsetX%, ny! * scale! + offsetY%)
  24.     lastX! = nx!
  25.     lastY! = ny!

Fossil Leaf  (maybe like drawings from ancient Greece)
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3-180111-067
  3. _TITLE "IFS Fossil Leaf"
  4.  
  5. scale! = 171.035
  6. offsetX% = 357
  7. offsetY% = 343
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. CLS , _RGB32(160, 160, 144)
  10. COLOR _RGB32(80, 64, 64, 50)
  11.  
  12. FOR iter& = 0 TO 1000000
  13.         CASE 0 TO .352
  14.             nx! = .202353 * lastX! + -.639381 * lastY! + .268058
  15.             ny! = .177023 * lastX! + .271414 * lastY! + .786708
  16.         CASE .353 TO .387
  17.             nx! = -.635039 * lastX! + .15876 * lastY! + -.049461
  18.             ny! = .575503 * lastX! + -.178604 * lastY! + .042522
  19.         CASE ELSE
  20.             nx! = .115852 * lastX! + -.739359 * lastY! + .379494
  21.             ny! = -.891958 * lastX! + -.126396 * lastY! + -.300873
  22.     END SELECT
  23.     IF iter& > 20& THEN PSET (nx! * scale! + offsetX%, ny! * scale! + offsetY%)
  24.     lastX! = nx!
  25.     lastY! = ny!

Recursive Tree
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3-180114-200
  3. _TITLE "IFS Recursive Tree"
  4.  
  5. scale! = 219.7
  6. offsetX% = 335
  7. offsetY% = -9
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. CLS , _RGB32(8, 8, 80)
  10. COLOR _RGB32(16, 224, 16, 32)
  11.  
  12. FOR iter& = 0 TO 1000000
  13.         CASE 0 TO .49
  14.             nx! = .705963 * lastX! + .358987 * lastY! + -.842529
  15.             ny! = -.358987 * lastX! + .705963 * lastY! + .287289
  16.         CASE .50 TO .98
  17.             nx! = .742239 * lastX! + -.300776 * lastY! + .905319
  18.             ny! = .300776 * lastX! + .742239 * lastY! + .118988
  19.         CASE ELSE
  20.             nx! = -.004846 * lastX! + -.006989 * lastY! + .388043
  21.             ny! = .510377 * lastX! + .510208 * lastY! + .73348
  22.     END SELECT
  23.     IF iter& > 20& THEN PSET (nx! * scale! + offsetX%, ny! * scale! + offsetY%)
  24.     lastX! = nx!
  25.     lastY! = ny!

Gnarled Tree
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap6-171203-84f
  3. _TITLE "IFS Gnarled Tree"
  4.  
  5. scaleX! = 194.287
  6. scaleY! = 149.698
  7. offsetX% = 352
  8. offsetY% = 291
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 0)
  11. COLOR _RGB32(96, 32, 16, 64)
  12.  
  13. FOR iter& = 0 TO 1000000
  14.         CASE 0 TO .159
  15.             nx! = .598158 * lastX! + -.356052 * lastY! + .67161
  16.             ny! = .356052 * lastX! + .598158 * lastY! + -.648611
  17.         CASE .16 TO .319
  18.             nx! = -.448094 * lastX! + .308849 * lastY! + -.502771
  19.             ny! = .365187 * lastX! + .577554 * lastY! + -.608248
  20.         CASE .32 TO .479
  21.             nx! = .006326 * lastX! + -.143369 * lastY! + -.064071
  22.             ny! = -.60489 * lastX! + .328351 * lastY! + .96276
  23.         CASE .48 TO .639
  24.             nx! = .299832 * lastX! + -.365076 * lastY! + .831409
  25.             ny! = .365076 * lastX! + .299832 * lastY! + .150385
  26.         CASE .64 TO .799
  27.             nx! = -.323505 * lastX! + .327934 * lastY! + -.647351
  28.             ny! = .358033 * lastX! + .437453 * lastY! + .205967
  29.         CASE ELSE
  30.             nx! = .066005 * lastX! + .050959 * lastY! + -.10212
  31.             ny! = .121996 * lastX! + -.32715 * lastY! + .704038
  32.     END SELECT
  33.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  34.     lastX! = nx!
  35.     lastY! = ny!
  36.  


Another tree without leaves
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap6-171203-84h
  3. _TITLE "IFS Fall Tree"
  4.  
  5. scaleX! = 131.734
  6. scaleY! = 88.0348
  7. offsetX% = 344
  8. offsetY% = 337
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 0)
  11. COLOR _RGB32(96, 32, 16, 64)
  12.  
  13. '[Parms]  6,  168.6201,  112.6828,  440,  431
  14. ' .620647,-.31522, .31522, .620647, .891658,-.742917, .16
  15. '-.554868, .059819, .162085, .652211,-.005441,-1.35337, .16
  16. '-.017134,-.064781,-.590634, .429267, .103238, 1.25386, .16
  17. ' .299832,-.365076, .365076, .299832, .950864, .024643, .16
  18. '-.334892, .313644, .347405, .44781,-.632132, .023339, .16
  19. '-.070131, .022771, .301621,-.427331, .085163, 1.02988, .16
  20.  
  21.  
  22. FOR iter& = 0 TO 1000000
  23.         CASE 0 TO .159
  24.             nx! = .620647 * lastX! + -.31522 * lastY! + .891658
  25.             ny! = .31522 * lastX! + .620647 * lastY! + -.742917
  26.         CASE .16 TO .319
  27.             nx! = -.554868 * lastX! + .059819 * lastY! + -.005441
  28.             ny! = .162085 * lastX! + .652211 * lastY! + -1.35337
  29.         CASE .32 TO .479
  30.             nx! = -.017134 * lastX! + -.064781 * lastY! + .103238
  31.             ny! = -.590634 * lastX! + .429267 * lastY! + 1.25386
  32.         CASE .48 TO .639
  33.             nx! = .29983 * lastX! + -.365076 * lastY! + .950864
  34.             ny! = .365076 * lastX! + .299832 * lastY! + .024643
  35.         CASE .64 TO .799
  36.             nx! = -.334892 * lastX! + .313644 * lastY! + -.632132
  37.             ny! = .347405 * lastX! + .44781 * lastY! + .023339
  38.         CASE ELSE
  39.             nx! = -.070131 * lastX! + .022771 * lastY! + .085163
  40.             ny! = .301621 * lastX! + -.427331 * lastY! + 1.02988
  41.     END SELECT
  42.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  43.     lastX! = nx!
  44.     lastY! = ny!
  45.  

Leaves
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3-180130-095
  3. _TITLE "IFS Nice Leaves"
  4.  
  5. scale! = 148.7642
  6. offsetX% = 391
  7. offsetY% = 203
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. CLS , _RGB32(32, 0, 8)
  10. COLOR _RGB32(0, 192, 0, 48)
  11.  
  12. FOR iter& = 0 TO 1000000
  13.         CASE 0 TO .36
  14.             nx! = .490662 * lastX! + .357636 * lastY! + .992214
  15.             ny! = -.367636 * lastX! + .490662 * lastY! + -.032411
  16.         CASE .37 TO .99
  17.             nx! = -.1878 * lastX! + -.893171 * lastY! + -.283457
  18.             ny! = -.67173 * lastX! + .196847 * lastY! + .612409
  19.         CASE ELSE
  20.             nx! = -.222345 * lastX! + -.170637 * lastY! + .900462
  21.             ny! = .129271 * lastX! + .118929 * lastY! + -.778578
  22.     END SELECT
  23.     IF iter& > 20& THEN PSET (nx! * scale! + offsetX%, ny! * scale! + offsetY%)
  24.     lastX! = nx!
  25.     lastY! = ny!

More Leaves
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3--180220-341
  3. _TITLE "IFS More Leaves"
  4.  
  5. scale! = 177.136
  6. offsetX% = 676
  7. offsetY% = 133
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. CLS , _RGB32(8, 8, 64)
  10. COLOR _RGB32(16, 224, 16, 32)
  11.  
  12. FOR iter& = 0 TO 1000000
  13.         CASE 0 TO .500
  14.             nx! = .161173 * lastX! + -.705634 * lastY! + -.881538
  15.             ny! = -.705634 * lastX! + -.161173 * lastY! + .717868
  16.         CASE .501 TO .990
  17.             nx! = .579204 * lastX! + -.271884 * lastY! + -.129897
  18.             ny! = .271884 * lastX! + .579204 * lastY! + .028496
  19.         CASE ELSE
  20.             nx! = -.286384 * lastX! + -.337266 * lastY! + -.490174
  21.             ny! = .223508 * lastX! + .280943 * lastY! + .382861
  22.     END SELECT
  23.     IF iter& > 20& THEN PSET (nx! * scale! + offsetX%, ny! * scale! + offsetY%)
  24.     lastX! = nx!
  25.     lastY! = ny!




« Last Edit: December 09, 2019, 12:36:19 am by AndyA »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Original IFS Fractals
« Reply #1 on: December 09, 2019, 11:06:50 am »
Hi Andy,

Very nice! amazing what a little bit of code can produce! Not only super fast, they seem super small compared to SDL as I remember, what? 3 years ago??

Say, do you have any pine trees?


Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
Re: Original IFS Fractals
« Reply #2 on: December 09, 2019, 04:06:43 pm »
Very nice!

Offline AndyA

  • Newbie
  • Posts: 73
Re: Original IFS Fractals
« Reply #3 on: December 09, 2019, 07:01:29 pm »
Thanks guys!

@bplus

The codes are much shorter because I don't have to :
1) Create a lookup table for alpha-drawing the fractal, just set the alpha level and let QB64 do it's stuff.
2) Don't have to create a histogram array to speed up the rendering process, once again QB64 is plenty fast. Being a compiled language that's not a big surprise.

Long term, I'm going to have to figure out how to work with Inform. Inform seems to be based on VB like code SUBs, where you design the form (UI) which generates the event SUBs, then fill in the SUBs and logic glue code. Very slick! Then I can recreate the fast BlitzPlus Basic IFS Viewer program in QB64.

As for pine trees (Christmas card/demo anyone?), I should be able to find or make a few for you. I'll try to hook you up in the next couple of days (work schedule permitting).




FellippeHeitor

  • Guest
Re: Original IFS Fractals
« Reply #4 on: December 09, 2019, 07:05:20 pm »
Long term, I'm going to have to figure out how to work with Inform. Inform seems to be based on VB like code SUBs, where you design the form (UI) which generates the event SUBs, then fill in the SUBs and logic glue code. Very slick! Then I can recreate the fast BlitzPlus Basic IFS Viewer program in QB64.

Let me know if you need any assistance with InForm ❤️

Offline AndyA

  • Newbie
  • Posts: 73
Re: Original IFS Fractals
« Reply #5 on: December 09, 2019, 09:41:05 pm »
Thanks for the encouragement Fellippe!  I may have to take you up on that :)

@bplus

It's kinda lopsided, but may be able to tweak to achieve symmetry.

Pine Tree
Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya
  2. 'ap3-191209-216
  3. _TITLE "IFS Pine Tree"
  4.  
  5. scaleX! = 524.0 '424.0 to 1024.0 look OK for X scaling factor
  6. scaleY! = 524.0
  7. offsetX% = 370
  8. offsetY% = 150
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 0)
  11. COLOR _RGB32(0, 228, 0, 24)
  12.  
  13. FOR iter& = 0 TO 1000000
  14.         CASE 0 TO .62
  15.             nx! = -0.858985 * lastX! + 0.008944 * lastY! + 0.092336
  16.             ny! = 0.012263 * lastX! + 0.84816 * lastY! + -0.04103
  17.         CASE .63 TO .98
  18.             nx! = -0.373759 * lastX! + -0.353068 * lastY! + 0.296535
  19.             ny! = 0.353068 * lastX! + -0.373759 * lastY! + 0.704598
  20.         CASE ELSE
  21.             nx! = 0.010276 * lastX! + 0 * lastY! + 0.053328
  22.             ny! = -0.05138 * lastX! + 0.313416 * lastY! + 0.576552
  23.     END SELECT
  24.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  25.     lastX! = nx!
  26.     lastY! = ny!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Original IFS Fractals
« Reply #6 on: December 09, 2019, 11:05:42 pm »
Hey not bad, thanks Andy!

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
Re: Original IFS Fractals
« Reply #7 on: December 14, 2019, 11:16:00 pm »
Amazing! I have never seen these before. Indeed, they all are original.
How you make this? I mean what you do for making new fractal?
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
Re: Original IFS Fractals
« Reply #8 on: December 15, 2019, 04:24:13 pm »
Cool... The only things missing are the scent of pine and the squeaking of squirrels... Nicely done!
Logic is the beginning of wisdom.

Offline AndyA

  • Newbie
  • Posts: 73
Re: Original IFS Fractals
« Reply #9 on: December 16, 2019, 12:05:57 am »
@Ashish
The first post has the links to the programs I use for designing the IFS Fractals. When using Apophysis, just remember to turn off the 'flame fractal' settings by unchecking all of the different types of effects (e.g. sinusoidal, spherical, swirl, horse shoe, etc.).

To do this, do the following:
1) Fire up Apophysis
2) Select 'Options' menu from the menu bar at the top
3) Select 'Options P' at the bottom of the drop down menu
4) This brings up an 'Options' dialog box.
5) Select the 'Clear All' button at the bottom right
6) Click the 'linear' checkbox at the top left (make sure linear is the only option left checked).
7) Click the 'OK' button.

Done. Now select one of the IFS fractal previews on the far left.  Press 'F4' and start messing with the triangles.

If you design something you like, save as an .IFS, not as a flame fractal.

@Johnno56
Thanks!  I hope these run a lot better than the others I did in SDL Basic, i.e. no run time errors for Linux users.