0

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;
        }
    }
Hazzlarn
  • 11
  • 4
  • does this program work? where? I guess your question is about this gui.putData(picture, 1*res, 1*res); - show a complete program otherwise no answer – gpasch Dec 11 '16 at 20:29
  • I cant really show a complete program since that would require me posting several pages of code. The program works fine, ive actually managed to solve it now, i had to resize the colormatrix and the complexmatrix according to the size of the pixels in each resolution ^^ – Hazzlarn Dec 11 '16 at 22:16

0 Answers0