Farben und verschiedene Julia-Formeln
This commit is contained in:
27
julia.py
27
julia.py
@@ -1,4 +1,5 @@
|
||||
from PIL import Image
|
||||
import math
|
||||
|
||||
# Bildeinstellungen
|
||||
width, height = 800, 800
|
||||
@@ -9,7 +10,12 @@ x_min, x_max = -1.5, 1.5
|
||||
y_min, y_max = -1.5, 1.5
|
||||
|
||||
# Die Konstante c (hier kannst du experimentieren!)
|
||||
c = complex(-0.7, 0.27015)
|
||||
#c = complex(-0.7, 0.27015)
|
||||
#c = complex(-0.4, -0.6)
|
||||
#c= complex(-0.123, 0.745)
|
||||
#c = complex (0.75)
|
||||
#c = complex (0,1)
|
||||
c = complex(-0.391, -0.587)
|
||||
|
||||
# Neues Bild erstellen (RGB-Modus)
|
||||
img = Image.new('RGB', (width, height), (0, 0, 0))
|
||||
@@ -29,11 +35,22 @@ for py in range(height):
|
||||
|
||||
# Einfärben
|
||||
if n < max_iter:
|
||||
# Ein einfacher Farbverlauf basierend auf n
|
||||
r = (n * 10) % 256
|
||||
g = (n * 5) % 256
|
||||
b = (n * 20) % 256
|
||||
# Die magische Formel für die Glättung
|
||||
# v = n + 1 - log2(log2(|z|))
|
||||
log_zn = math.log(z.real ** 2 + z.imag ** 2) / 2
|
||||
nu = math.log(log_zn / math.log(2)) / math.log(2)
|
||||
iteration = n + 1 - nu
|
||||
|
||||
# Farbe berechnen (Sinus-Wellen erzeugen sanfte Übergänge)
|
||||
r = int(128 + 127 * math.sin(0.3 * iteration + 0.0))
|
||||
g = int(128 + 127 * math.sin(0.3 * iteration + 2.0))
|
||||
b = int(128 + 127 * math.sin(0.3 * iteration + 4.0))
|
||||
pixels[px, py] = (r, g, b)
|
||||
# Ein einfacher Farbverlauf basierend auf n
|
||||
# r = (n * 10) % 256
|
||||
# g = (n * 5) % 256
|
||||
# b = (n * 20) % 256
|
||||
# pixels[px, py] = (r, g, b)
|
||||
else:
|
||||
# Inneres der Menge bleibt schwarz
|
||||
pixels[px, py] = (0, 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user