Im currently trying to visualize shapes as a prep before eventually moving on to visualize the Mandelbrot Equation. I've got into some issues with the resolution though. In my render-method I'm fetching a matrix with complex values, and placing the colormatrix on top of it. For the highest resolution this works, because the pixelsize in the colormatrix elements have the same height and width as the elements in the complexmatrix. My question is how i could apply this for lower resolutions? :P
public void render(MandelbrotGUI gui) {
gui.disableInput();
Complex[][] complex = this.mesh(gui.getMinimumReal(), gui.getMaximumReal(),
gui.getMinimumImag(), gui.getMaximumImag(), gui.getWidth(), gui.getHeight());
int res = 0;
switch(gui.getResolution()){
case 2048: res = 1;
break;
case 1024: res = 3;
break;
case 512: res = 5;
break;
case 256: res = 7;
break;
case 128: res = 9;
break;
}
Color[][] picture = new Color[gui.getHeight()][gui.getWidth()];
switch(gui.getMode()){
case 32:
for(int k = 0; k < gui.getWidth(); k++){
for(int i = 0; i < gui.getHeight(); i++){
if(Math.sqrt(complex[i][k].getAbs2()) > 1){
picture[i][k] = Color.BLACK;
}
else{
picture[i][k] = Color.WHITE;
}
}
}
gui.putData(picture, 1*res, 1*res);
gui.enableInput();
break;
case 64: break;
}
}