361aa988bc419c472fb6df5b6291ef2285f63d0b
- Author
- Pavle Portic <pavle.portic@tilda.center>
- Committer
- Pavle Portic <pavle.portic@tilda.center>
- Date
Message
Optimize calculation for points that are on the main cardioid and bulb
Diff
1diff --git a/mandelbrot.py b/mandelbrot.py
2index 93f1f60846208446b14045672d2540274918aeaa..5ff0bc766c2f2b7c9493a8197618b1fecec26ef9 100644
3--- a/mandelbrot.py
4+++ b/mandelbrot.py
5@@ -36,6 +36,12 @@ def get_points(cols, rows):
6 def calculate_point(x, y):
7 global ITERATIONS
8 z = 0
9+ p = (x - 0.25) ** 2 + y ** 2
10+ if p * (p + (x - 0.25)) < 0.25 * (y ** 2):
11+ return -1
12+ if (x + 1) ** 2 + y ** 2 <= 0.0625:
13+ return -1
14+
15 for i in range(MAX_ITERS):
16 ITERATIONS += 1
17 z = z ** 2 + complex(x, y)