Post by The Joyful Programmer on May 14, 2021 22:18:48 GMT -5
Here's a majorly modified version of BPlus's demo...
'from Lauwerier H., 1991. "Fractals Images of Chaos" Penguin 209p.
'Orbits of Henon's Quadratic System
'Name: HENON
Dim OuterLoop As _Unsigned _Integer64
Dim OuterLoopMax As _Unsigned _Integer64
Dim OuterLoopModMax As _Unsigned _Integer64
Dim InnerLoop As _Unsigned _Integer64
Dim InnerLoopMax As _Unsigned _Integer64
Dim OrbitX As _Float
Dim OrbitY As _Float
Dim OrbitZ As _Float
Dim Alpha As _Float
Dim Beta As _Float
Dim ScaleX As _Float
Dim ScaleY As _Float
Dim ColorDecision As _Float
Dim NumberOfSteps As _Float
Dim StepSize As _Float
Dim ShakeOffsetX As _Float
Dim ShakeOffsetY As _Float
Dim ShakeSizeX As _Float
Dim ShakeSizeXMax As _Float
Dim ShakeSizeY As _Float
Dim ShakeSizeYMax As _Float
Dim WindowWidth As _Unsigned Integer
Dim WindowWidthHalf As _Unsigned Integer
Dim WindowHeight As _Unsigned Integer
Dim WindowHeightHalf As _Unsigned Integer
Dim BoxSize As _Unsigned Integer
Dim BoxSizeHalf As _Unsigned Integer
Dim cRed As _Unsigned _Byte
Dim cGreen As _Unsigned _Byte
Dim cBlue As _Unsigned _Byte
Dim cAlpha As _Unsigned _Byte
Dim cNull As _Unsigned _Byte
NumberOfSteps = 7
StepSize = 1 / NumberOfSteps
BoxSize = 0
BoxSizeHalf = BoxSize / 2
OuterLoopMax = 200000
OuterLoopModMax = Rnd * 100
InnerLoopMax = 5000
WindowWidth = 800
WindowWidthHalf = WindowWidth / 2
WindowHeight = 600
WindowHeightHalf = WindowHeight / 2
ScaleX = WindowWidthHalf
ScaleY = WindowHeightHalf
ShakeSizeXMax = 5
ShakeSizeYMax = 5
Screen _NewImage(WindowWidth, WindowHeight, 32)
_Delay .25
_ScreenMove _Middle
_Title "Orbits of Henon's quadratic system"
Randomize Timer
cRed = Rnd * 155 + 100
cGreen = Rnd * 155 + 100
cBlue = Rnd * 155 + 100
cAlpha = 5
cNull = 1
Color _RGBA32(cRed, cGreen, cBlue, cAlpha)
For OuterLoop = 0 To OuterLoopMax
If OuterLoop Mod OuterLoopModMax = 0 Then
ShakeSizeX = Rnd * 1
ShakeSizeY = Rnd * ShakeSizeYMax
OuterLoopModMax = Rnd * 100 + 1
ColorDecision = Rnd
cRed = Rnd * 155 + 100
cGreen = Rnd * 155 + 100
cBlue = Rnd * 155 + 100
BoxSize = Rnd * 2
BoxSizeHalf = BoxSize / 2
If ColorDecision > StepSize * 6 Then
Color _RGBA32(cRed, cGreen, cBlue, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > StepSize * 5 Then
Color _RGBA32(cRed, cNull, cNull, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > StepSize * 4 Then
Color _RGBA32(cNull, cGreen, cNull, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > StepSize * 3 Then
Color _RGBA32(cNull, cNull, cBlue, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > StepSize * 2 Then
Color _RGBA32(cRed, cGreen, cNull, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > StepSize * 1 Then
Color _RGBA32(cRed, cNull, cBlue, cAlpha + ShakeSizeYMax - ShakeSizeY)
ElseIf ColorDecision > 0 Then
Color _RGBA32(cNull, cGreen, cBlue, cAlpha + ShakeSizeYMax - ShakeSizeY)
End If
End If
OrbitX = -0.8 + Rnd
OrbitY = -0.8 + Rnd
Alpha = 0.29 '.24
Beta = Sqr(1 - Alpha ^ 2)
For InnerLoop = 0 To InnerLoopMax
ShakeOffsetX = Rnd * ShakeSizeX
ShakeOffsetY = Rnd * ShakeSizeY
x1 = WindowWidth - (OrbitX * ScaleX + WindowWidthHalf) - BoxSizeHalf - ShakeOffsetX
y1 = (OrbitY * ScaleY + WindowHeightHalf) - BoxSizeHalf - ShakeOffsetY
x2 = x1 + BoxSize
y2 = y1 + BoxSize
Line (x1, y1)-(x2, y2), , BF
'Circle (x1, y1), BoxSize
OrbitZ = OrbitX
OrbitX = OrbitX * Alpha - (OrbitY - OrbitX * OrbitX) * Beta
OrbitY = OrbitZ * Beta + (OrbitY - OrbitZ * OrbitZ) * Alpha
If (Abs(OrbitX) + Abs(OrbitY)) > 10 Then InnerLoop = InnerLoopMax
Next InnerLoop
'_Display
Next OuterLoop
a$ = Input$(1)
System