• February 27, 2021, 10:18:23 PM

Login with username, password and session length

Author Topic: (Other) Smoke and mirrors  (Read 280 times)

0 Members and 1 Guest are viewing this topic.

Offline youhn

  • Fractal Friend
  • **
  • Posts: 14
  • Shapes only exist in your head
(Other) Smoke and mirrors
« on: January 20, 2021, 10:22:08 PM »
Short morph and rotation of a 4D julia of the well known \( z \rightarrow z^2 + c \), applying some geometric algebra in Python.


Source used to learn the algebra: https://www.youtube.com/watch?v=nJnWM7R6Y5A

Python code:

Code: [Select]
import matplotlib.pyplot as plt
import math
 
def linspace(start, stop, num):
    return [start + (stop - start) / (num - 1) * k for k in range(num)]
 
def zeros(rows, cols):
    return [[0 for j in range(cols)] for i in range(rows)]
 
d, n = 400, 280  # pixel density & number of iterations
r = 2 * 2 ** 2  # escape radius (must be greater than 2**2)
x = linspace(-1.7, 1.7, 4 * d + 1)
y = linspace(-1.3, 1.3, 3 * d + 1)
T = zeros(len(y), len(x))
var = linspace(0.0, 1*3.14159, 300) # parameter variation and no. of frames

# time loop
for m, varc in enumerate(var):
    # x in geometric algebra [scalar, e12, e23, e31]
    a0 = 0.0
    b0 = 0.0
    c0 = 0.0244 + math.sin(varc*2)*0.01
    d0 = 0.76 - math.cos(varc*2)*0.1
   
    # image loop
    for i, dp in enumerate(y):
        for j, bp in enumerate(x):
            a = bp * math.sin(varc)
            b = bp * math.cos(varc)
            c = 0.0
            d = dp
            # iteration loop to check for escape or bound
            for k in range(n):
                aa = a ** 2
                bb = b ** 2
                cc = c ** 2
                dd = d ** 2
                if aa + bb + cc + dd > r:
                    break
                # set temp variables to prevent calcuation errors
                ax = a
                bx = b
                cx = c
                dx = d
                a = aa - bb - cc - dd + a0
                b = (ax*bx - cx*dx)
                b = b + b + b0
                c = (ax*cx + bx*dx)
                c = c + c + c0
                d = (ax*dx - bx*cx)
                d = d + d + d0
            T[i][j] = k + 1
     
    filename = "julia" + str(m).zfill(3) + ".png"
    print(filename, c0, d0 )
    plt.imshow(T, cmap=plt.cm.twilight_shifted)
    plt.axis('off')
    plt.savefig(filename, dpi=400, bbox_inches="tight", pad_inches=0)


Linkback: https://fractalforums.org/fractal-movie-gallery/19/smoke-and-mirrors/3996/

Offline Sabine62

  • 3e
  • *****
  • Posts: 1106
  • It's just a jump to the left...
    • sabine62.deviantart.com
Re: Smoke and mirrors
« Reply #1 on: January 21, 2021, 10:15:06 AM »
Very nice, I like the 'liquid glass' look! :yes: :thumbs:
To thine own self be true


xx
"Time Span"

Started by cricke49 on Fractal Image Gallery

0 Replies
803 Views
Last post August 02, 2018, 07:05:21 AM
by cricke49
xx
OpenGL font rendering

Started by sjhalayka on Programming

2 Replies
369 Views
Last post April 20, 2020, 05:00:47 PM
by sjhalayka
clip
A new style of fractal imagery using fractal neural style transfer

Started by iRyanBell on Fractal Image Gallery

3 Replies
698 Views
Last post October 03, 2020, 10:50:39 PM
by Jimw338
xx
Inside infinity mirrors

Started by Fraktalist on Share a fractal

9 Replies
1471 Views
Last post November 25, 2017, 07:00:31 PM
by Deliberate Dendrite
xx
room full of mirrors

Started by mclarekin on Fractal Image Gallery

0 Replies
159 Views
Last post July 17, 2018, 08:59:48 AM
by mclarekin