小编Hug*_*ugo的帖子

Mandelbrot设置平滑着色函数

我用 python 编写了 Mandelbrot 集,但这看起来很奇怪,所以我寻找平滑的颜色。我已经使用对数和线性插值编写了一个平滑的着色函数,但无论我尝试什么,我都无法得到我想要的:

self.palette = [(3, 25, 61),(5, 43, 107),(7, 61, 153),(20, 96, 226),(20, 164, 226),(74, 181, 226),(138, 211, 242),(205, 234, 247),(225, 237, 242),(255,255,255)]
Run Code Online (Sandbox Code Playgroud)

这是我的调色板

if n == self.max_iterations:
    self.screen.set_at((x, y), (110, 13, 13))
else:
    gradient = 1 + n - math.log(math.log(abs(m))) / math.log(2.0)
    iteration = n + 1 - gradient
    color1 = list(self.palette[n % 10])
    if n % 10 <= 8:
        color2 = list(self.palette[n % 10+1])
    else:
        color2 = list(self.palette[-1])

    color = [[], [], []]
    for number, …
Run Code Online (Sandbox Code Playgroud)

python math mandelbrot python-3.x

4
推荐指数
1
解决办法
468
查看次数

标签 统计

mandelbrot ×1

math ×1

python ×1

python-3.x ×1