1 /*
2     FLAM3 - cosmic recursive fractal flames
3     Copyright (C) 1992-2009 Spotworks LLC
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 3 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, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef interpolation_included
20 #define interpolation_included
21 
22 #include "private.h"
23 
24 #define INTERP(x)  do { result->x = 0.0; \
25    for (k = 0; k < ncp; k++) result->x += c[k] * cpi[k].x; } while(0)
26 
27 #define INTERI(x)  do { double tt = 0.0; \
28    for (k = 0; k < ncp; k++) tt += c[k] * cpi[k].x; \
29    result->x = (int)rint(tt); } while(0)
30 
31 double adjust_percentage(double in);
32 double motion_funcs(int funcnum, double timeval);
33 
34 double smoother(double t);
35 double get_stagger_coef(double t, double stagger_prc, int num_xforms, int this_xform);
36 
37 double det_matrix(double s[2][2]);
38 int id_matrix(double s[3][2]);
39 int zero_matrix(double s[3][2]);
40 void copy_matrix(double to[3][2], double from[3][2]);
41 void clear_matrix(double m[3][2]);
42 void sum_matrix(double s, double m1[3][2], double m2[3][2]);
43 void mult_matrix(double s1[2][2], double s2[2][2], double d[2][2]);
44 
45 int compare_xforms(const void *av, const void *bv);
46 
47 void interpolate_cmap(flam3_palette cmap, double blend,
48               int index0, double hue0, int index1, double hue1);
49 void interp_and_convert_back(double *c, int ncps, int xfi, double cxang[4][2],
50                              double cxmag[4][2], double cxtrn[4][2],double store_array[3][2]);
51 void convert_linear_to_polar(flam3_genome *cp, int ncps, int xfi, int cflag,
52                              double cxang[4][2], double cxmag[4][2], double cxtrn[4][2]);
53 
54 void interpolate_catmull_rom(flam3_genome cps[], double t, flam3_genome *result);
55 void flam3_interpolate_n(flam3_genome *result, int ncp, flam3_genome *cpi, double *c, double stagger);
56 void establish_asymmetric_refangles(flam3_genome *cp, int ncps);
57 void flam3_align(flam3_genome *dst, flam3_genome *src, int nsrc);
58 #endif
59