home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / fracxtr4.zip / SMURF2.ZIP / TESTPT.C < prev   
C/C++ Source or Header  |  1991-10-14  |  1KB  |  50 lines

  1. Tim,
  2. Here is a testpt.c file to display the "phoenix_m" mandel stye map and its
  3. julia equivalent "phoenix_j".  Best params for phoenix_j are 0.56667 and -0.5
  4. at 256 iterations. Space could be saved in FRACTINT by switching on symmetry
  5. which is NOSYM for phoenix_m and XAXIS for phoenix_j.   B.Smurf
  6.  
  7.  #include "fractint.h"
  8.  #include "fractype.h"
  9.  
  10.  extern double magnitude;
  11.  extern struct complex init,tmp,old,new,saved;
  12.  
  13.  void teststart()
  14.  {
  15.  }
  16.  
  17.  void testend()
  18.  {
  19.  }
  20.  
  21.  testpt(initreal,initimag,parm1,parm2,maxit,inside)
  22.  double initreal,initimag,parm1,parm2;
  23.  int maxit,inside;
  24.  {
  25.  double x_square, y_square, x_temp, y_temp, r , i;
  26.  int color;
  27.     color = x_square = y_square = new.x = new.y = 0;
  28.     magnitude = 0.0;
  29.     if (parm1) {  /* Julia style */
  30.        old.x = initreal; old.y = initimag;
  31.        r = parm1; i = parm2;
  32.        }
  33.     else {        /* Mandelbrot style */
  34.        old.x = old.y = 0;
  35.        r = initreal; i = initimag;
  36.        }
  37.     while ((magnitude < 4.0) && (color < maxit)) {
  38.        x_square = old.x * old.x;
  39.        y_square = old.y * old.y;
  40.        x_temp = x_square - y_square + r + i * new.x;
  41.        y_temp = 2 * old.x * old.y + i * new.y;
  42.        new.x = old.x;  new.y = old.y;
  43.        old.x = x_temp; old.y = y_temp;
  44.        magnitude = x_square + y_square;
  45.        color++;
  46.        }
  47.  if (color >= maxit) color = inside;
  48.  return(color);
  49.  }
  50.