I am trying to create an image of the Mandelbrot set, but some are obviously very wrong. This code produces this image: I am using Scala and processing. The color technique is very simple but I do not think this is the main problem seeing the image size thanks.
For (i & lt; -0 to width) {// 0 to 700 (j & lt; -0 to height) {// 0 to 400 plus x = i / 200.to Double-2.5 2.5 / 2.5 to Scale -2, 1 Val y = j / 200.to Double-1/1 to Scale, 1 Well C = New Complex (X, Y) Val Immer Max = 1000 var Z = c var iterations = 0 var inset = false while (z.abs & lt; 2 & amp; repeat & lt; iterMax) {z = z.squared.plus (C) iterations = = 1 if (iterations = = IterMax) {inSet = true}} // stroke () defines the current RGB color // If the point is in the set, If its color is black // If not, then this kind of color is color: (iterative ^ 5 Mod 255, iterative ^ 7 mode 255, iterated ^ 11 Mod 255) // I use 5, 7 and 11 for any particular reasons Does not do for Only once again the illustration is used in a black picture if (inetet) stroke (0, 0, 0) other stroke (pow (iterative, 5) .toInt% 255, pow (iterative, 7) .toInt% 255, Pau (iterative, 11) .toInt% 255) // Finally, point the point (i, j)}}
for the complex number is the square here
Your plus
method is not combined with Other
, I think it should be
Def plus (second: complex) = new complex (real + second, real, image + other. Imag)
Comments
Post a Comment