added more colors to Fatou, still wrong...
git-svn-id: svn://anubis/gvsu@323 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
7d8588148f
commit
4cb7cc0e38
@ -8,6 +8,8 @@
|
|||||||
#define CLOSE_ENOUGH(z, x, y) \
|
#define CLOSE_ENOUGH(z, x, y) \
|
||||||
(fabs(creal(z) - (x)) < LEEWAY && fabs(cimag(z) - (y)) < LEEWAY)
|
(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)
|
unsigned int FatouComputation::compute(double x, double y)
|
||||||
{
|
{
|
||||||
double complex z = 0.1;
|
double complex z = 0.1;
|
||||||
@ -18,7 +20,7 @@ unsigned int FatouComputation::compute(double x, double y)
|
|||||||
z = p * (1 - z) * z;
|
z = p * (1 - z) * z;
|
||||||
if (cabs(z) > 2.0)
|
if (cabs(z) > 2.0)
|
||||||
{
|
{
|
||||||
return 0xFF * ((double) iter / (double) ITERATIONS);
|
return colors[iter % (sizeof(colors)/sizeof(colors[0]))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -107,17 +107,17 @@ int main(int argc, char * argv[])
|
|||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
switch (event.button.button)
|
switch (event.button.button)
|
||||||
{
|
{
|
||||||
case 1: /* left-click to re-center */
|
case 1: /* left-click to re-center and zoom in */
|
||||||
x_center = getXVirt(event.button.x);
|
|
||||||
y_center = getYVirt(event.button.y);
|
|
||||||
redraw = true;
|
|
||||||
break;
|
|
||||||
case 3: /* re-center AND zoom in */
|
|
||||||
x_center = getXVirt(event.button.x);
|
x_center = getXVirt(event.button.x);
|
||||||
y_center = getYVirt(event.button.y);
|
y_center = getYVirt(event.button.y);
|
||||||
zoom /= 2.0;
|
zoom /= 2.0;
|
||||||
redraw = true;
|
redraw = true;
|
||||||
break;
|
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 */
|
case 4: /* zoom in */
|
||||||
zoom /= 2.0;
|
zoom /= 2.0;
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user