Mandelbrot设置使用枕头libray放大python

我不知道如何放大mandelbrot集以及如何更改坐标以进行缩放。 我想知道我应该设置图像中心吗,例如:x = -0.3123和y = -0.1212,现在将其缩放或将x,y更改为任何数字? 有人可以向我解释吗? 我的代码:

import math

from PIL import Image

height = 360
width = 640

#plot window
X_START = -2.5
X_END = 2.5
Y_START = -1.5
Y_END = 1.5
base_zoom = 1
for i in range(1,30):
    img = Image.new("HSV",(width,height),0)
    X_START = -2.5 * base_zoom
    X_END = 2.5 * base_zoom
    Y_START = -1.5 * base_zoom
    Y_END = 1.5 * base_zoom
    maxIter = 100
    pixels = img.load()
    for x in range(width):
        print(f"Did: {math.floor(x / width * 1000 / 10)} %  of picture nr {i}")
        for y in range(height):

            a = (x / width) * (X_END - X_START) + X_START
            b = (y/ height) * (Y_END - Y_START) + Y_START


            ca = a
            cb = b

            n = 0


            while n<maxIter:

                aa = -2
                bb = 2 * a * b


                if abs(aa + bb) > 4:
                    bright = int(255 * n % maxIter)
                    saturation = 185
                    value = 218
                    pixels[x,y] = (bright,saturation,value)
                a = aa
                b = bb
                n+=1







    base_zoom *= 0.5
    # img.show()
    img.convert('RGB').save(f'pictures_mandelbrot\picture{i}.BMP')


qulinyang 回答:Mandelbrot设置使用枕头libray放大python

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3041539.html

大家都在问