I wrote an implementation of the Mandelbrot set in Java using a JComponent but I’m getting strange results when I render it. Besides that everything compiles right. I’m just not for sure what I’m doing wrong with it. Any code review also would be appreciated.
My source is posted on pastebin since it would take up too much room here:
Problem:
Solution:
renderPointmethod to acceptdoublearguments and call it asrenderPoint((x - h)/100.0, (k - y)/100.0)to see something more interesting.renderPointtoreturn (((r << 16) | (g << 8) | b)<<4)and settingMaxColorBit = 16.A code review:
(int)Math.floor(Width / 2)can be replaced byWidth / 2, because that is an integer division.WidthandHeightwith small letters (widthandheight), because that is a Java convention which helps differentiate classes and attributes.iterationsattribute is not used.