View Single Post
  #1 (permalink)  
Old 05-03-2008, 11:13 PM
Sephirangel Sephirangel is offline
Member
 
Join Date: May 2008
Posts: 2
Sephirangel is on a distinguished road
Threading a method
Hey,
I have a method which calculates fractal points and displays them as an Image.
What i would like to know, is how to make the method so that the threads concurrently take it in turns to work out the points themselves in the set efficiently.

Heres the code for the mandelbrot method;

Code:
private void mandelbrot() { // calculate all points int x, y; float h, b, alt = 0.0f; actionOn = false; setCursor(c1); //showStatus("Computing Mandelbrot-Set ..."); for (x = 0; x < x1; x++) { for (y = 0; y < y1; y++) { h = pickColIndex(xStart + xZoom * (double)x, yStart + yZoom * (double)y); // color value if (h != alt) { b = 1.0f - h * h; // brightnes g1.setColor(Color.getHSBColor(h, 0.8f, b)); alt = h; } g1.drawLine(x, y, x + 1, y); } }
Thanks in advance!
Josh

PS: im new to the forums so hello!!!!
Reply With Quote
Sponsored Links