标签: mandelbrot

为什么一幅图像(Mandelbrot)会被扭曲并环绕?

因此,我只是写了一个小片段来生成Mandelbrot分形,并想象我的惊喜,当它出来时都是丑陋和倾斜的(正如你在底部看到的那样).我很欣赏为什么会发生这种情况的方向.这是一次学习经历,我不是在寻找任何人为我做这件事,但我有点在调试它.违规代码是:

module Mandelbrot where
import Complex
import Image

main = writeFile "mb.ppm" $ imageMB 1000

mandelbrotPixel x y = mb (x:+y) (0:+0) 0

mb c x iter | magnitude x > 2 = iter
            | iter >= 255     = 255
            | otherwise       = mb c (c+q^2) (iter+1)
    where q = x -- Mandelbrot
          -- q = (abs.realPart $ x) :+ (abs.imagPart $ x) --Burning Ship

argandPlane x0 x1 y0 y1 width height = [ (x,y) | 
        y <- [y1, y1 …
Run Code Online (Sandbox Code Playgroud)

haskell image mandelbrot

7
推荐指数
1
解决办法
442
查看次数

为什么龟可以点亮像素?

我创建Mandelbrot集的程序有一个错误:每当笔改变颜色时,每隔42个像素就会变亮.这是一个非常巧合的mandelbug(是的,我刚刚学过这个术语),因为它对于"边缘"附近的许多像素是不一致的(它实际上可能在它应该是的颜色和最后一个颜色之间模糊,或者接下来,像素应该是),但它总是在那之后的第42个像素,直到下一个颜色变化.我使用的是OSX 10.6.8,PYTHON 2.7.当我在学校写这个程序时,它完美地工作(Windows),然后我把它发送给自己,并且更多地工作(大多只是制作样本大小,因此图像更大),然后运行它,我得到了这个错误.编辑:我的坏,我忘了提到这只发生在我的Mandelbrot程序,我在家里的其他几个海龟程序都很好.

截图的一部分(这样你就不必在程序运行时永远等待,看看我在说什么):

从我家的第一个版本:

我的意思是,是什么?

从当前版本(侧面):

请注意:此图片是侧面的

下面是代码:

import turtle
import math
turtle.speed(0)
def benoit(onelen):
    turtle.left(90)
    for x in range(-2*onelen, onelen):
        turtle.up()
        turtle.goto(x, int(-1.5*onelen)-1)
        turtle.down()
        for y in range(int(-1.5*onelen)-1, int(1.5*onelen)-1):
            z = complex(0,0)
            c = complex(x*1.0/onelen,y*1.0/onelen)
            for k in range(20):
                z = z*z+c
                if abs(z) > 2:
                    g = .2 + .8*(20-k)/20
                    break
                if k == 19:
                    g = 0
            turtle.pencolor(0,g,0)
            turtle.forward(1)
benoit(250)
x = raw_input("Press Enter to Exityadayadayada")
Run Code Online (Sandbox Code Playgroud)

编辑:DSM建议修复,他喜欢这个bug.但是,我没有编辑Python源代码的经验,所有下划线都让我感到紧张.有人能告诉我具体编辑和/或如何编辑?

python turtle-graphics mandelbrot

7
推荐指数
1
解决办法
1333
查看次数

对于那里的所有创意人士:着色mandelbrot集......需要创意

给定最大迭代次数= 1000,给我一些关于如何着色(红色,绿色,蓝色)的想法.我现在所能得到的都是跛脚2色渐变:(

实际上是否有可能想出像这样美丽的东西?

在此输入图像描述

colors mandelbrot

6
推荐指数
2
解决办法
3501
查看次数

我的Mandelbrot设置代码出了什么问题?

我正在尝试用C语言实现Mandelbrot,但我遇到了一个奇怪的问题.我的代码如下:

#include <stdio.h>
#include <math.h>
#include <complex.h>

int iterate_pt(complex c);

int main() {
FILE *fp;
fp = fopen("mand.ppm", "w+");


double crmin = -.75;
double crmax = -.74;
double cimin = -.138;
double cimax = -.75; //Changing this value to -.127 fixed my problem.

int ncols = 256;
int nrows = 256;
int mand[ncols][nrows];
int x, y, color;
double complex c;

double dx = (crmax-crmin)/ncols;
double dy = (cimax-cimin)/nrows;

for (x = 0; x < ncols; x++){
    for (y = 0; …
Run Code Online (Sandbox Code Playgroud)

c mandelbrot

6
推荐指数
1
解决办法
1554
查看次数

C Mandelbrot设置着色

我正在使用C中的以下代码.到目前为止它已经全部工作并且它被缩放到正确的级别等,但是我正在努力让颜色按照我的意愿工作.理想情况下,无论颜色如何,我都希望得到类似的东西:

Mandelbrot设置正确的颜色

但是我的程序如下所示产生的内容如下:

目前Mandelbrot集

因此,我很感激任何帮助,我可以得到颜色,因为我希望他们.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define ITERMAX 100.0
#define DIVERGING 1.1
#define XMAX 500
#define YMAX 500
#define COLORINTENSITY 255

/* allow up to ITERMAX feedbacks searching for convergence
for the feedback
  z0 = 0 + 0i
  znew = z^2 + c
If we have not diverged to distance DIVERGING before ITERMAX feedbacks
we will assume the feedback is convergent at this value of c.
We will report divergence if |z|^2 > DIVERGING
*/

/* We …
Run Code Online (Sandbox Code Playgroud)

c mandelbrot

6
推荐指数
1
解决办法
565
查看次数

Mandelbrot设置显示不正确

这是我尝试使用Pygame模块对Python 3.5中的Mandelbrot集进行编程.

import math, pygame
pygame.init()

def mapMandelbrot(c,r,dim,xRange,yRange):
    x = (dim-c)/dim
    y = (dim-r)/dim
    #print([x,y])
    x = x*(xRange[1]-xRange[0])
    y = y*(yRange[1]-yRange[0])
    x = xRange[0] + x
    y = yRange[0] + y
    return [x,y]

def checkDrawBox(surface):
    for i in pygame.event.get():
        if i.type == pygame.QUIT:
            pygame.quit()
        elif i.type == pygame.MOUSEBUTTONDOWN:
            startXY = pygame.mouse.get_pos()
            boxExit = False
            while boxExit == False:
                for event in pygame.event.get():
                    if event.type == pygame.MOUSEBUTTONUP:
                        boxExit = True
                if boxExit == True:
                    return [startXY,pygame.mouse.get_pos()]
                pygame.draw.rect(surface,[255,0,0],[startXY,[pygame.mouse.get_pos()[0]-startXY[0],pygame.mouse.get_pos()[1]-startXY[1]]],1)
                pygame.display.update()

def setup():
    dimensions …
Run Code Online (Sandbox Code Playgroud)

python mandelbrot python-3.x

6
推荐指数
1
解决办法
175
查看次数

使用两个浮点数的 Webgl 双精度模拟没有效果

在玩弄一代时Mandelbrot setWebGl我不可避免地发现了OpenGl32 位的小精度float然而,当我发现这篇很棒的文章时,新的希望诞生了。
我小心翼翼地从上述源代码中获取了函数,并double 在 JS 端添加了解构。

据我了解,JSdoubles对于浮点数有 64 位,所以我的想法是在 JS 端计算一些准备数据,将其作为浮点数对发送到 GPU,然后继续进行 mandelbrot 循环。

可悲的是,最后我看到结果图像的差异几乎为零,而且我真的不知道我的失败点在哪里。

JS:

function doubleToFloat(d) {
  return new Float32Array([d])[0];
};
function splitDouble(dbl) { //splits JS number to array of 2 32bit floats
    var arr = [];
    arr[0] = doubleToFloat(dbl);
    arr[1] = doubleToFloat(dbl - arr[0]);
    //console.log(dbl, arr);
    arr = new Float32Array(arr);
    dlog(dbl,arr);
    return arr;
};

///Somewhere inside rendering function - binding data to webGl …
Run Code Online (Sandbox Code Playgroud)

javascript opengl double mandelbrot webgl

6
推荐指数
0
解决办法
2347
查看次数

如何从调色板中进行颜色渐进

我正在使用此算法的目标是从某些提供的颜色中输出颜色渐变。颜色渐进是指在两种颜色(颜色A,颜色B)之间创建“淡入淡出”效果,并在它们之间存储每个颜色值((R,G,B)元组)。

例如,如果提供的是全黑A = (0,0,0)和全白,B = (255,255,255)则结果将是:

P = ((0,0,0),(1,1,1),(2,2,2), .... ,(253,253,253),(254,254,254),(255,255,255)

这样我们一开始就变成白色,然后逐渐变成黑色。当然,使用白色和黑色非常容易(只需将RGB每步增加255次即可)。但是,如果我想用两种任意颜色执行此过程,例如A =(180,69,1)和B =(233,153,0),该怎么办?

重要说明:如果使用十六进制(或任何其他类型的颜色表示法)更容易实现,我也可以使用它,只需指定哪种类型即可(考虑到我正在使用PIL(Python Imaging Library) ,因此如果与之兼容,我很好)

显然,它必须是尽可能均匀的分布,其进程必须是均匀的。

我需要弄清楚这个算法,以便可以在我的分形生成器中使用它(Mandelbrot集,如果需要,可以在google上搜索它),因此,使进程尽可能柔和,无打ic至关重要。

提前致谢。

python algorithm fractals mandelbrot color-palette

5
推荐指数
1
解决办法
2183
查看次数

放大Mandelbrot在Java中设置分形

我开始制作一个mandelbrot集分形查看器.在放大分形时,我遇到了很多问题.如果您尝试缩放,则查看器将关闭中心.我尽我所能去理解这种困境.如何以这样的方式放大我的分形:当我缩放时,它会放大屏幕的中心,而不是分形的中心?

import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import java.awt.event.*;



public class Mandelbrot extends JFrame implements ActionListener {

    private JPanel ctrlPanel;
    private JPanel btnPanel;
    private int numIter = 50;
    private double zoom = 130;
    private double zoomIncrease = 100;
    private int colorIter = 20;
    private BufferedImage I;
    private double zx, zy, cx, cy, temp;
    private int xMove, yMove = 0;
    private JButton[] ctrlBtns = new JButton[9];
    private Color themeColor = new Color(150,180,200);

    public Mandelbrot() {
        super("Mandelbrot Set");
        setBounds(100, 100, 800, 600); …
Run Code Online (Sandbox Code Playgroud)

java zoom fractals mandelbrot

5
推荐指数
2
解决办法
9054
查看次数

Mandelbrot扰动是如何工作的?

有人可以解释一下本文中描述的扰动是如何加速渲染Mandelbrot集的吗?

我知道如何使用传统方法渲染Mandelbrot集合,其中对每个像素执行许多迭代,但我不太明白该文章中描述的是什么.

我像这样计算参考轨道:

std::complex<double> Xo(some_x, some_y);
std::complex<double> Xn(0,0);

for (int n = 0; n < maxIterations; ++n) {
  orbit.push_back(Xn);
  Xn = Xn * Xn + Xo;
}
Run Code Online (Sandbox Code Playgroud)

那是对的吗?那么我如何使用参考轨道计算所有其他像素?

c++ mandelbrot

5
推荐指数
1
解决办法
724
查看次数