Optimize calculation for points that are on the main cardioid and bulb

This commit is contained in:
Pavle Portic 2019-02-03 14:44:35 +01:00
parent 7cc4c4ce21
commit 361aa988bc
Signed by: TheEdgeOfRage
GPG Key ID: 6758ACE46AA2A849
1 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,12 @@ def get_points(cols, rows):
def calculate_point(x, y):
global ITERATIONS
z = 0
p = (x - 0.25) ** 2 + y ** 2
if p * (p + (x - 0.25)) < 0.25 * (y ** 2):
return -1
if (x + 1) ** 2 + y ** 2 <= 0.0625:
return -1
for i in range(MAX_ITERS):
ITERATIONS += 1
z = z ** 2 + complex(x, y)