0

So, I want to use monte carlo intergration to calculate the area of the mandelbrot set (Mandelbrot Set@Wiki). The point at which I am is that I have X sample with T iterations. My question is on how I could plot the X samples; these are just plain x,y coordinates. The thing is that I find anything with a GUI quite cumbersome in JAVA, so any help would be great. Here is the code that I use, to get a view on how I do things.

public static void main(String[] args) {
    mandelbrot1 program = new mandelbrot1();
    program.mc(iterations, samples);        
}

So, I am going to let mc() return an array of some sort of objects containing the x,y pairs. Or just as arrays.

What I would ideally want is to have a method which has as input an arraylist of Point objects, and which would then draw all of those points.

Ideas?

Thanks!

4

1 回答 1

1

You have a few options to represent points in Java. You could use a 3D array (i.e. array[width][height][2]) or you can use a 2D array and store Point (http://docs.oracle.com/javase/7/docs/api/java/awt/Point.html) objects in it. As far as drawing them to the screen, no method for drawing pixels exists in Java graphics, but you can either use drawLine and pass in the same point twice (i.e. drawLine(x,y,x,y)) or you can use a bufferedImage, and use img.setRGB(x, y, col) to set an individual pixel (http://www.javamex.com/tutorials/graphics/bufferedimage_setrgb.shtml).

于 2013-10-30T12:16:25.250 回答