summaryrefslogtreecommitdiff
path: root/thorn_fractal.py
diff options
context:
space:
mode:
Diffstat (limited to 'thorn_fractal.py')
-rwxr-xr-xthorn_fractal.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/thorn_fractal.py b/thorn_fractal.py
new file mode 100755
index 0000000..ed0e431
--- /dev/null
+++ b/thorn_fractal.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+import numpy as np
+import matplotlib.pyplot as plt
+
+img_res_x = 2000
+img_res_y = 2000
+
+xmin = -np.pi
+xmax = np.pi
+ymin = -np.pi
+ymax = np.pi
+
+escape = 10000
+iterations = 255
+c_x = 0
+c_y = 0
+
+
+image = np.empty([img_res_y, img_res_x], np.float32)
+
+for pix_y, y in enumerate(np.linspace(ymin, ymax, img_res_y)):
+ for pix_x, x in enumerate(np.linspace(xmin, xmax, img_res_x)):
+ on_x = x
+ on_y = y
+ for i in range(iterations):
+ next_x = (on_x/np.sin(on_y))
+ on_y = (on_y/np.sin(on_x))
+ on_x = next_x
+ if on_x**2 + on_y**2 > escape:
+ break
+ image[pix_y][pix_x] = i
+ #print(pix_y)
+
+
+
+
+plt.style.use('dark_background')
+# fuck this shit
+fig = plt.figure(frameon=False)
+fig.set_size_inches(img_res_x/fig.dpi, img_res_y/fig.dpi)
+#fig.set_size_inches(width/height, 1, forward=False)
+print(fig.dpi)
+
+ax = plt.Axes(fig, [0., 0., 1., 1.])
+ax.set_axis_off()
+fig.add_axes(ax)
+
+cmap = plt.cm.viridis
+cmap.set_bad((0,0,0))
+cmap.set_over((0,0,0))
+cmap.set_under((0,0,0))
+
+ax.imshow(image, norm="log", aspect="auto", cmap=cmap)
+fig.savefig("animation/cpu.png")
+#plt.show()