December 03, 2020, 08:34:24 PM

Author Topic: [bb] Lorenz 3D by BlitzSupport [ 1+ years ago ]  (Read 713 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Lorenz 3D by BlitzSupport [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Lorenz 3D
Author : BlitzSupport
Posted : 1+ years ago

Description : This is a port of the fractal created by meteorologist Lorenz. Whereas the image has previously been drawn in only 2 dimensions due to lack of a 3rd, this version lets you see the fractal the way it's meant to be seen! Use the controls as described...

I recommend downloading <a href="http://www.hi-toro.com/blitz/lorenz3d.zip" target="_blank">this ZIP file[/url] [59K] with its custom sprite, as the default drawing is rather boring! This really makes it look very 'Tron'-like :)

EDIT (24 May 2017): Couple of quick links  to above ZIP file, can't upload to original location right now:

<a href="http://s000.tinyupload.com/index.php?file_id=78520137689960463917" target="_blank">http://s000.tinyupload.com/index.php?file_id=78520137689960463917[/url]
<a href="https://www.sendspace.com/file/tjynz2" target="_blank">https://www.sendspace.com/file/tjynz2[/url]


Code :
Code: BlitzBasic
  1. ; Lorenz Attractor in 3D... from 'Computers and Chaos' by Conrad Bessant,
  2. ; converted from AmigaBASIC to Blitz3D by james @ hi - toro . com :)
  3.  
  4. ; CONTROLS:
  5.  
  6. ; Cursors + A & Z, or mouse + both buttons.
  7. ; SPACE toggles drawing.
  8.  
  9. AppTitle "Lorenz Attractor in 3D"
  10.  
  11. ; Display mode...
  12.  
  13. sw = 640 : sh = 480
  14. ;sw = 1024: sh = 768
  15.  
  16. Graphics3D sw, sh
  17.  
  18. ; I don't pretend to understand any of this, but play with a, b and c for
  19. ; different results...
  20.  
  21. a# = 10
  22. b# = 28
  23. c# = 8.0 / 3.0
  24.  
  25. dt# = 0.01
  26.  
  27. x# = 1
  28. y# = 1
  29. z# = 1
  30.  
  31. ; Render every iteration (eg. 2 renders every 2nd iteration, etc)...
  32.  
  33. detail = 1
  34.  
  35. cam = CreateCamera ()
  36. CameraRange cam, 0.1, 1000
  37. PositionEntity cam, 0, 0, -50
  38.  
  39. ball = LoadSprite ("point.bmp", 16 + 32)
  40. If ball
  41.         ScaleSprite ball, 2.5, 2.5
  42.         spritescale# = 0.5
  43. Else
  44.         ball = CreateSprite (): EntityColor ball, 0, 255, 0
  45.         spritescale# = 0.25
  46. EndIf
  47.  
  48. wind = Load3DSound ("wind.wav")
  49. If wind
  50.         LoopSound wind
  51.         CreateListener (cam, 1, 0.1)
  52.         windchannel = EmitSound (wind, ball)
  53. EndIf
  54.  
  55. SetFont LoadFont ("arial", 15, 1)
  56.  
  57. fps = CreateTimer (60)
  58.  
  59. Repeat
  60.  
  61.         WaitTimer (fps)
  62.        
  63.         MoveMouse GraphicsWidth () / 2, GraphicsHeight () / 2
  64.         TurnEntity cam, -MouseYSpeed () / 5.0, -MouseXSpeed () / 5.0, 0
  65.        
  66.         If (KeyDown (30)) Or (MouseDown (1))
  67.                 MoveEntity cam, 0, 0, 0.5
  68.         Else
  69.                 If (KeyDown (44)) Or (MouseDown (2))
  70.                         MoveEntity cam, 0, 0, -0.5
  71.                 EndIf
  72.         EndIf
  73.        
  74.         If KeyHit (57)
  75.                 stopdrawing = 1 - stopdrawing
  76.                 If wind Then ChannelVolume windchannel, 1 - stopdrawing
  77.         EndIf
  78.        
  79.         If KeyDown (203)
  80.                 TurnEntity cam, 0, 2, 0
  81.         Else
  82.                 If KeyDown (205)
  83.                         TurnEntity cam, 0, -2, 0
  84.                 EndIf
  85.         EndIf
  86.  
  87.         If KeyDown (200)
  88.                 TurnEntity cam, 2, 0, 0
  89.         Else
  90.                 If KeyDown (208)
  91.                         TurnEntity cam, -2, 0, 0
  92.                 EndIf
  93.         EndIf
  94.  
  95.         If stopdrawing = False
  96.  
  97.                 ; These six lines are the equation which produces the whole thing!
  98.                
  99.                 dx# = a * (y - x)
  100.                 dy# = b * x - y - x * z
  101.                 dz# = x * y - c * z
  102.  
  103.                 x = x + dx * dt
  104.                 y = y + dy * dt
  105.                 z = z + dz * dt
  106.        
  107.                 frames = frames + 1
  108.                 If frames Mod detail = 0
  109.                         PositionEntity ball, x, y, z
  110.                         newball = CopyEntity (ball)
  111.                         ScaleSprite newball, spritescale, spritescale
  112.                 EndIf
  113.  
  114.         EndIf
  115.        
  116.         RenderWorld
  117.  
  118.         If stopdrawing
  119.                 Text 20, 20, "Iterations, drawn every " + detail + " frame(s): " + frames + "  -- use SPACE to pause/continue"
  120.         EndIf
  121.        
  122.         Flip
  123.        
  124. Until KeyHit (1)
  125.  
  126. End


Comments :


Ben(t)(Posted 1+ years ago)

 i'm sorry but what is this supposed to do?


xlsior(Posted 1+ years ago)

 It draws a fractal in 3D. Use cursor keys to rotate, and mouse buttons to zoom in/out.


BlitzSupport(Posted 2 weeks ago)

 Couple of copies of archive...<a href="http://s000.tinyupload.com/index.php?file_id=78520137689960463917" target="_blank">http://s000.tinyupload.com/index.php?file_id=78520137689960463917[/url]<a href="https://www.sendspace.com/file/tjynz2" target="_blank">https://www.sendspace.com/file/tjynz2[/url]


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal