aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-02-15 18:39:00 +0530
committerAkshay Nair <phenax5@gmail.com>2025-02-15 18:39:57 +0530
commit381101385d632b169ce87fa29873c5bdb0a038b0 (patch)
treea65a5dfdc08e1897753740638777ea537cde08ac
parent8d3e624490779607fbbe1eef65afa7e0e5be2cac (diff)
downloaduiua-creative-coding-381101385d632b169ce87fa29873c5bdb0a038b0.tar.gz
uiua-creative-coding-381101385d632b169ce87fa29873c5bdb0a038b0.zip
Add julia set fractal
-rw-r--r--6-julia/main.ua26
-rw-r--r--6-julia/output-600.gifbin0 -> 248956 bytes
-rw-r--r--6-julia/output-600.pngbin0 -> 74018 bytes
-rw-r--r--6-julia/output.gifbin0 -> 248956 bytes
-rw-r--r--6-julia/output.pngbin0 -> 74018 bytes
-rw-r--r--README.md11
6 files changed, 36 insertions, 1 deletions
diff --git a/6-julia/main.ua b/6-julia/main.ua
new file mode 100644
index 0000000..5fca4d5
--- /dev/null
+++ b/6-julia/main.ua
@@ -0,0 +1,26 @@
+W ← 200 # width
+H ← 200 # height
+S ← 0.35 # scale
+I ← 30 # max iterations
+Ox ← 0 # offset x
+Oy ← 0 # offset y
+F ← 24 # number of frames for gif
+Fps ← 8 # frame rate for gif
+
+ToPixel ← ⍣(
+ 0.18_0.2_0.25 ⍤.=I
+| 0.92_0.93_0.96 ⍤.≥20
+| 0.37_0.5_0.67 ⍤.>13
+| 0.64_0.75_0.55 ⍤.>11
+| 0.74_0.38_0.41 ⍤.>8
+| 0_0_0
+)
+
+C ← ×0.7885 ⁿ(×i)e
+Iterations ← ◌:◌: ⌵ ⍢(⊙(+⊙.×.) +1|× ⊙(<100⌵) <I) 0 :C
+Grid ← ⊞ℂ ∩(÷S -0.5 ÷H) ⊓(-Oy)(-Ox) ⇡H⇡W
+Img ← ∵(ToPixel Iterations ×1.62π) Grid
+&fwa "./6-julia/output.png" img "png" Img
+
+Frames ← ≡(∵(ToPixel Iterations :) Grid) ×τ÷F⇡F
+&fwa "./6-julia/output.gif" gif Fps Frames
diff --git a/6-julia/output-600.gif b/6-julia/output-600.gif
new file mode 100644
index 0000000..530d8a5
--- /dev/null
+++ b/6-julia/output-600.gif
Binary files differ
diff --git a/6-julia/output-600.png b/6-julia/output-600.png
new file mode 100644
index 0000000..a81d92d
--- /dev/null
+++ b/6-julia/output-600.png
Binary files differ
diff --git a/6-julia/output.gif b/6-julia/output.gif
new file mode 100644
index 0000000..530d8a5
--- /dev/null
+++ b/6-julia/output.gif
Binary files differ
diff --git a/6-julia/output.png b/6-julia/output.png
new file mode 100644
index 0000000..a81d92d
--- /dev/null
+++ b/6-julia/output.png
Binary files differ
diff --git a/README.md b/README.md
index cf8228a..e86a8de 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
<table>
<tr>
<td width="50%" valign="top">
- <h3><a href="1-mandelbrot/main.ua">Mandelbrot set fractal</a></h3>
+ <h3><a href="1-mandelbrot/main.ua">Mandelbrot Set</a></h3>
<img src="1-mandelbrot/output-1080.png" />
</td>
<td width="50%" valign="top">
@@ -38,5 +38,14 @@ https://github.com/user-attachments/assets/18ce9a04-b597-4340-876d-8585a054c6ad
&nbsp;
</td>
</tr>
+
+ <tr>
+ <td width="50%" valign="top">
+ <h3><a href="6-julia/main.ua">Julia Set</a></h3>
+ <img src="6-julia/output-600.gif?raw=true" />
+ </td>
+ <td width="50%" valign="top">
+ </td>
+ </tr>
</table>