|
|
Hello,
I'm trying to make pictures of the mandelbrot set. I found several
examples on the web but I have a problem to adapt the sources.
Signifiant part of Java code building colors table :
import java.awt.Color;
int max = 1000;
int[] colors = new int[max];
for (int i = 0; i<max; i++) {
colors[i] = Color.HSBtoRGB(i/256f, 1, i/(i+8f));
}
Displaying "colors" table give :
0 : 0.000000 0.000000 0.000000
1 : 0.109804 0.003922 0.000000
2 : 0.200000 0.007843 0.000000
3 : 0.274510 0.019608 0.000000
4 : 0.333333 0.031373 0.000000
5 : 0.384314 0.043137 0.000000
6 : 0.427451 0.058824 0.000000
7 : 0.466667 0.078431 0.000000
8 : 0.501961 0.094118 0.000000
...
...
Trying to do in POVRay :
#include "colors.inc"
#declare Max = 1000;
#declare ColorsArray = array[Max];
#declare i=0;
#while(i<Max)
#declare ColorsArray[i] = CHSL2RGB(<i/256, 1, i/(i+8)>);
#declare i=i+1;
#end
"ColorsArray" give :
0 : 0.000000 0.000000 0.000000
1 : 0.222222 0.003704 0.000000
2 : 0.400000 0.013333 0.000000
3 : 0.545455 0.027273 0.000000
4 : 0.666667 0.044444 0.000000
5 : 0.769231 0.064103 0.000000
6 : 0.857143 0.085714 0.000000
7 : 0.933333 0.108889 0.000000
8 : 1.000000 0.133333 0.000000
...
he result is very different and, of course, the image does
not give the same thing... iI suspect the value 'hue' passed to the
macro, but after several attempts I can't do it (i/360, i*360/max,...)
A little help would be welcome :)
Refs :
-----
* Page for Java source - Let’s draw the Mandelbrot set!
<http://jonisalonen.com/2013/lets-draw-the-mandelbrot-set/>
* Page for online java execution if you want to test code...
<https://www.tutorialspoint.com/compile_java_online.php>
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|