// Render the fractal using a Complex data type on a single thread with scalar floats public void RenderMultiThreadedWithADT(float xmin, float xmax, float ymin, float ymax, float step) { Parallel.For(0, (int)(((ymax - ymin) / step) + .5f), (yp) => { if (Abort) return; float y = ymin + step * yp; int xp = 0; for (float x = xmin; x < xmax; x += step, xp++) { ComplexFloat num = new ComplexFloat(x, y); ComplexFloat accum = num; int iters = 0; float sqabs = 0f; do { accum = accum.square(); accum += num; iters++; sqabs = accum.sqabs(); } while (sqabs < limit && iters < max_iters); DrawPixel(xp, yp, iters); } }); }
// Render the fractal using a Complex data type on a single thread with scalar floats public void RenderSingleThreadedWithADT(float xmin, float xmax, float ymin, float ymax, float step) { int yp = 0; for (float y = ymin; y < ymax && !Abort; y += step, yp++) { int xp = 0; for (float x = xmin; x < xmax; x += step, xp++) { ComplexFloat num = new ComplexFloat(x, y); ComplexFloat accum = num; int iters = 0; float sqabs = 0f; do { accum = accum.square(); accum += num; iters++; sqabs = accum.sqabs(); } while (sqabs < limit && iters < max_iters); DrawPixel(xp, yp, iters); } } }