Mandelbrot program isn't outputting correct data

风流意气都作罢 提交于 2019-11-28 12:53:09

It computes beautifully. Only you made a mess of instance variables and arguments.

In CalcMBF, it should be:

var originala = aWork;
aWork = (aWork * aWork) - (bWork * bWork) + aOut;
bWork = (2 * originala * bWork) + bOut;

where you had xCalc and yCalc, which are not local to CalcMBF. Furthermore, the imaginary part needs to be computed with the initial value of aWork. Interestingly, it still works with that bug, but it is a different fractal attractor.

The mandelbrot set has its interesting regions in the complex plane at -2<=cr<=1 and -1<=ci<=1, so a constant bailout at iteration 2 can indicate that you chose your c value outside or in some boring region like the middle of the lake.

If you need more speed, remove the square root and compare distanceXY <= 4 instead.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!