~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/flame/libifs.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
   /*
52
52
    * first, set up xform, which is an array that converts a uniform random
53
53
    * variable into one with the distribution dictated by the density
54
 
    * fields 
 
54
    * fields
55
55
    */
56
56
   dr = 0.0;
57
57
   for (i = 0; i < NXFORMS; i++)
101
101
         p[0] += v * nx;
102
102
         p[1] += v * ny;
103
103
      }
104
 
      
 
104
 
105
105
      v = vari[1];
106
106
      if (v > 0.0) {
107
107
         /* sinusoidal */
111
111
         p[0] += v * nx;
112
112
         p[1] += v * ny;
113
113
      }
114
 
      
 
114
 
115
115
      v = vari[2];
116
116
      if (v > 0.0) {
117
117
         /* complex */
134
134
         p[0] += v * nx;
135
135
         p[1] += v * ny;
136
136
      }
137
 
      
 
137
 
138
138
      v = vari[4];
139
139
      if (v > 0.0) {
140
140
         /* horseshoe */
204
204
   d[1][1] = s1[0][1] * s2[1][0] + s1[1][1] * s2[1][1];
205
205
}
206
206
 
207
 
double det_matrix(s)
 
207
static double det_matrix(s)
208
208
   double s[2][2];
209
209
{
210
210
   return s[0][0] * s[1][1] - s[0][1] * s[1][0];
211
211
}
212
212
 
213
 
void flip_matrix(m, h)
 
213
#if 0
 
214
static void flip_matrix(m, h)
214
215
   double m[2][2];
215
216
   int h;
216
217
{
234
235
   }
235
236
}
236
237
 
237
 
void transpose_matrix(m)
 
238
static void transpose_matrix(m)
238
239
   double m[2][2];
239
240
{
240
241
   double t;
242
243
   m[0][1] = m[1][0];
243
244
   m[1][0] = t;
244
245
}
 
246
#endif
245
247
 
246
 
void choose_evector(m, r, v)
 
248
#if 0
 
249
static void choose_evector(m, r, v)
247
250
   double m[3][2], r;
248
251
   double v[2];
249
252
{
264
267
}
265
268
 
266
269
 
267
 
/* diagonalize the linear part of a 3x2 matrix.  the evalues are returned 
 
270
/* diagonalize the linear part of a 3x2 matrix.  the evalues are returned
268
271
   in r as either reals on the diagonal, or a complex pair.  the evectors
269
272
   are returned as a change of coords matrix.  does not handle shearing
270
273
   transforms.
271
274
   */
272
275
 
273
 
void diagonalize_matrix(m, r, v)
 
276
static void diagonalize_matrix(m, r, v)
274
277
   double m[3][2];
275
278
   double r[2][2];
276
279
   double v[2][2];
351
354
}
352
355
 
353
356
 
354
 
void undiagonalize_matrix(r, v, m)
 
357
static void undiagonalize_matrix(r, v, m)
355
358
   double r[2][2];
356
359
   double v[2][2];
357
360
   double m[3][2];
385
388
   m[1][0] = t2[1][0];
386
389
   m[1][1] = t2[1][1];
387
390
}
 
391
#endif
388
392
 
389
 
void interpolate_angle(t, s, v1, v2, v3, tie, cross)
 
393
static void interpolate_angle(t, s, v1, v2, v3, tie, cross)
390
394
   double t, s;
391
395
   double *v1, *v2, *v3;
392
396
   int tie;
425
429
   *v3 = s * x + t * y;
426
430
}
427
431
 
428
 
void interpolate_complex(t, s, r1, r2, r3, flip, tie, cross)
 
432
static void interpolate_complex(t, s, r1, r2, r3, flip, tie, cross)
429
433
   double t, s;
430
434
   double r1[2], r2[2], r3[2];
431
435
   int flip, tie, cross;
471
475
}
472
476
 
473
477
 
474
 
void interpolate_matrix(t, m1, m2, m3)
 
478
static void interpolate_matrix(t, m1, m2, m3)
475
479
   double m1[3][2], m2[3][2], m3[3][2];
476
480
   double t;
477
481
{
688
692
   *argc = i;
689
693
}
690
694
 
691
 
int compare_xforms(a, b)
 
695
static int compare_xforms(a, b)
692
696
   xform *a, *b;
693
697
{
694
698
   double aa[2][2];
719
723
 * must integrate with tcl soon...
720
724
 */
721
725
 
722
 
void parse_control_point(ss, cp) 
 
726
void parse_control_point(ss, cp)
723
727
   char **ss;
724
728
   control_point *cp;
725
729
{
749
753
      cp->wiggle[j][0] = 0.0;
750
754
      cp->wiggle[j][1] = 60.0;
751
755
   }
752
 
   
 
756
 
753
757
   tokenize(ss, argv, &argc);
754
758
   for (i = 0; i < argc; i++) {
755
759
      if (streql("xform", argv[i]))
804
808
        slot = &cmap_inter;
805
809
        set_cmap_inter = 1;
806
810
      } else
807
 
         *slot++ = atof(argv[i]);
 
811
        *slot++ = g_strtod(argv[i], NULL);
808
812
   }
809
813
   if (set_cm) {
810
814
      cp->cmap_index = (int) cm;
869
873
}
870
874
 
871
875
/* returns a uniform variable from 0 to 1 */
872
 
double random_uniform01() {
 
876
double random_uniform01(void) {
873
877
   return g_random_double ();
874
878
}
875
879
 
876
 
double random_uniform11() {
 
880
double random_uniform11(void) {
877
881
   return g_random_double_range (-1, 1);
878
882
}
879
883
 
880
884
/* returns a mean 0 variance 1 random variable
881
885
   see numerical recipies p 217 */
882
 
double random_gaussian() {
 
886
double random_gaussian(void) {
883
887
   static int iset = 0;
884
888
   static double gset;
885
889
   double fac, r, v1, v2;
904
908
  int i, j;
905
909
  for (i = 0; i < NXFORMS; i++) {
906
910
    for (j = 0; j < NVARS; j++)
907
 
      cp0->xform[i].var[j] = 
 
911
      cp0->xform[i].var[j] =
908
912
        cp1->xform[i].var[j];
909
913
  }
910
914
}
911
915
 
912
 
     
 
916
 
913
917
 
914
918
#define random_distrib(v) ((v)[g_random_int_range (0, vlen(v))])
915
919
 
916
 
void random_control_point(cp, ivar) 
 
920
void random_control_point(cp, ivar)
917
921
   control_point *cp;
918
922
   int ivar;
919
923
{
959
963
         cp->xform[i].var[var] = 1.0;
960
964
      else
961
965
         cp->xform[i].var[random_distrib(mixed_var_distrib)] = 1.0;
962
 
      
 
966
 
963
967
   }
964
968
   for (; i < NXFORMS; i++)
965
969
      cp->xform[i].density = 0.0;
985
989
 
986
990
   min[0] = min[1] =  1e10;
987
991
   max[0] = max[1] = -1e10;
988
 
   
 
992
 
989
993
   for (i = 0; i < batch; i++) {
990
994
      if (points[i][0] < min[0]) min[0] = points[i][0];
991
995
      if (points[i][1] < min[1]) min[1] = points[i][1];
1000
1004
      bmax[1] = max[1];
1001
1005
      return;
1002
1006
   }
1003
 
   
 
1007
 
1004
1008
   delta[0] = (max[0] - min[0]) * 0.25;
1005
1009
   delta[1] = (max[1] - min[1]) * 0.25;
1006
1010
 
1033
1037
 
1034
1038
/* use hill climberer to find smooth ordering of control points
1035
1039
   this is untested */
1036
 
   
 
1040
 
1037
1041
void sort_control_points(cps, ncps, metric)
1038
1042
   control_point *cps;
1039
1043
   int ncps;
1073
1077
{
1074
1078
   int i, j, k;
1075
1079
   double t;
1076
 
   
 
1080
 
1077
1081
   double dist = 0.0;
1078
1082
   for (i = 0; i < NXFORMS; i++) {
1079
1083
      double var_dist = 0.0;
1094
1098
   return dist;
1095
1099
}
1096
1100
 
1097
 
void
 
1101
#if 0
 
1102
static void
1098
1103
stat_matrix(f, m)
1099
1104
   FILE *f;
1100
1105
   double m[3][2];
1116
1121
   fprintf(f, "theta = %g det = %g\n", a,
1117
1122
           m[0][0] * m[1][1] - m[0][1] * m[1][0]);
1118
1123
}
 
1124
#endif
1119
1125
 
1120
1126
 
1121
1127
#if 0