home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / bomb.tar.gz / bomb.tar / bomb / libifs.h < prev    next >
C/C++ Source or Header  |  1998-01-06  |  3KB  |  91 lines

  1. /*
  2.     fractal flame generation package
  3.     Copyright (C) 1992, 1993  Scott Draves <spot@cs.cmu.edu>
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. #ifndef libifs_included
  21. #define libifs_included
  22.  
  23. #include <stdio.h>
  24.  
  25. #define NVARS   8
  26. #define NXFORMS 6
  27.  
  28. typedef double ifs_point[3];
  29.  
  30. typedef struct {
  31.    double var[NVARS];   /* normalized interp coefs between variations */
  32.    double c[3][2];      /* the coefs to the affine part of the function */
  33.    double density;      /* prob is this function is chosen. 0 - 1 */
  34.    double color;        /* color coord for this function. 0 - 1 */
  35. } ifs_xform;
  36.  
  37. #define have_cmap 0
  38.  
  39. typedef struct {
  40.    ifs_xform xform[NXFORMS];
  41. #if have_cmap
  42.    cmap cmap;
  43. #endif
  44.    double time;
  45.    int  cmap_index;
  46.    double brightness;           /* 1.0 = normal */
  47.    double contrast;             /* 1.0 = normal */
  48.    double gamma;
  49.    int  width, height;        /* of the final image */
  50.    int  spatial_oversample;
  51.    double corner[2];            /* camera corner */
  52.    double pixels_per_unit;      /* and scale */
  53.    double spatial_filter_radius; /* variance of gaussian */
  54.    double sample_density;        /* samples per pixel (not bucket) */
  55.    /* in order to motion blur more accurately we compute the logs of the 
  56.       sample density many times and average the results.  we interplate
  57.       only this many times. */
  58.    int nbatches;
  59.    /* this much color resolution.  but making it too high induces clipping */
  60.    int white_level;
  61.    int cmap_inter; /* if this is true, then color map interpolates one entry
  62.               at a time with a bright edge */
  63.    double pulse[2][2]; /* [i][0]=magnitute [i][1]=frequency */
  64.    double wiggle[2][2]; /* frequency is /minute, assuming 30 frames/s */
  65. } ifs_control_point;
  66.  
  67.  
  68. #if __STDC__
  69. # define P(x)x
  70. #else
  71. # define P(x)()
  72. #endif
  73.  
  74.  
  75.  
  76. extern void iterate P((ifs_control_point *cp, int n, int fuse, ifs_point points[]));
  77. extern void interpolate P((ifs_control_point cps[], int ncps, double time, ifs_control_point *result));
  78. extern void tokenize P((char **ss, char *argv[], int *argc));
  79. extern void print_control_point P((FILE *f, ifs_control_point *cp, int quote));
  80. extern void sprint_control_point P((char *f, ifs_control_point *cp, int quote));
  81. extern void random_control_point P((ifs_control_point *cp));
  82. extern void estimate_bounding_box P((ifs_control_point *cp, double eps, double *bmin, double *bmax));
  83. extern void sort_control_points P((ifs_control_point *cps, int ncps, double (*metric)()));
  84. extern double standard_metric P((ifs_control_point *cp1, ifs_control_point *cp2));
  85. extern double random_uniform01 P(());
  86. extern double random_uniform11 P(());
  87. extern double random_gaussian P(());
  88. extern void mult_matrix P((double s1[2][2], double s2[2][2], double d[2][2]));
  89. extern int parse_control_point();
  90. #endif
  91.