diff --git a/cs677/final/FatouComputation.cc b/cs677/final/FatouComputation.cc index ca9b1ed..29afaf9 100644 --- a/cs677/final/FatouComputation.cc +++ b/cs677/final/FatouComputation.cc @@ -8,6 +8,8 @@ #define CLOSE_ENOUGH(z, x, y) \ (fabs(creal(z) - (x)) < LEEWAY && fabs(cimag(z) - (y)) < LEEWAY) +static unsigned int colors[] = {0xFF0000, 0x00FF00, 0x0000FF}; + unsigned int FatouComputation::compute(double x, double y) { double complex z = 0.1; @@ -18,7 +20,7 @@ unsigned int FatouComputation::compute(double x, double y) z = p * (1 - z) * z; if (cabs(z) > 2.0) { - return 0xFF * ((double) iter / (double) ITERATIONS); + return colors[iter % (sizeof(colors)/sizeof(colors[0]))]; } } return 0; diff --git a/cs677/final/mpi-fractals.cc b/cs677/final/mpi-fractals.cc index 2bfa625..256ed99 100644 --- a/cs677/final/mpi-fractals.cc +++ b/cs677/final/mpi-fractals.cc @@ -107,17 +107,17 @@ int main(int argc, char * argv[]) case SDL_MOUSEBUTTONDOWN: switch (event.button.button) { - case 1: /* left-click to re-center */ - x_center = getXVirt(event.button.x); - y_center = getYVirt(event.button.y); - redraw = true; - break; - case 3: /* re-center AND zoom in */ + case 1: /* left-click to re-center and zoom in */ x_center = getXVirt(event.button.x); y_center = getYVirt(event.button.y); zoom /= 2.0; redraw = true; break; + case 2: /* middle click just to re-center */ + x_center = getXVirt(event.button.x); + y_center = getYVirt(event.button.y); + redraw = true; + break; case 4: /* zoom in */ zoom /= 2.0; redraw = true;