Erste lauffähige Version
This commit is contained in:
@@ -8,14 +8,14 @@ def mandelbrot (c, max_iter):
|
|||||||
z = z*z + c
|
z = z*z + c
|
||||||
return max_iter
|
return max_iter
|
||||||
|
|
||||||
width = 600
|
width = 800
|
||||||
height = 800
|
height = 600
|
||||||
|
|
||||||
img = Image.new('RGB', (width, height))
|
img = Image.new('RGB', (width, height))
|
||||||
|
|
||||||
# die komplexe Ebene definieren
|
# die komplexe Ebene definieren
|
||||||
x_min, x_max = -2 , 1
|
x_min, x_max = -2 , 1
|
||||||
y_min, y_max = -1.5, 1.5
|
y_min, y_max = -1.2, 1.2
|
||||||
|
|
||||||
for x in range(width):
|
for x in range(width):
|
||||||
for y in range(height):
|
for y in range(height):
|
||||||
@@ -24,4 +24,17 @@ for x in range(width):
|
|||||||
c = complex(real, imag)
|
c = complex(real, imag)
|
||||||
print ("x-> ", x, " y-> ", y, " -> ",c)
|
print ("x-> ", x, " y-> ", y, " -> ",c)
|
||||||
|
|
||||||
|
m = mandelbrot(c, 100)
|
||||||
|
|
||||||
|
# Einfache Farbgebung: Schwarz für die Menge, Blau-Töne für den Rand
|
||||||
|
if m == 100:
|
||||||
|
color = (0, 0, 0)
|
||||||
|
else:
|
||||||
|
color = (0, 0, m * 2 % 255) # Blau-Gradient
|
||||||
|
|
||||||
|
img.putpixel((x, y), color)
|
||||||
|
|
||||||
|
img.save("mandelbrot.png")
|
||||||
|
print("Bild wurde als mandelbrot.png gespeichert!")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
mandelbrot.png
Normal file
BIN
mandelbrot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Reference in New Issue
Block a user