[xiph-commits] r12058 - trunk/sushivision

giles at svn.xiph.org giles at svn.xiph.org
Tue Nov 7 10:34:14 PST 2006


Author: giles
Date: 2006-11-07 10:34:13 -0800 (Tue, 07 Nov 2006)
New Revision: 12058

Modified:
   trunk/sushivision/example_fractal.c
Log:
Add max iter as a dimension. This is a little fragile; we should 
generate scale range based on the maximum value, still defined
by MAX_ITER, instead of setting it manually. We still need to
divide by MAX_ITER instead of the actual max_iter to avoid rescaling the 
field when the number of iterations changes.


Modified: trunk/sushivision/example_fractal.c
===================================================================
--- trunk/sushivision/example_fractal.c	2006-11-07 18:09:23 UTC (rev 12057)
+++ trunk/sushivision/example_fractal.c	2006-11-07 18:34:13 UTC (rev 12058)
@@ -24,16 +24,18 @@
 #include <math.h>
 #include "sushivision.h"
 
+#define MAX_ITER 16384
+
 sushiv_instance_t *s;
-#define MAX_ITER 1024
 
 static double fractal_objective(double *d){
   int i;
   double z, zi, zz;
+  const int max_iter = d[4];
   const double c=d[0],ci=d[1];
 
   z = d[2]; zi = d[3];
-  for(i=0;i<MAX_ITER;i++){
+  for(i=0;i<max_iter;i++){
     zz = z*z - zi*zi + c;
     zi = 2.0*z*zi + ci;
     z  = zz;
@@ -64,13 +66,18 @@
 		       5,(double []){-2.25,-1,0,1,2.25},
 		       NULL,
 		       SUSHIV_X_RANGE|SUSHIV_Y_RANGE);
-  
+
+  sushiv_new_dimension(s,4,"Iter",
+		       8,(double []){128,256,512,1024,2048,4096,8192,MAX_ITER},
+  		       NULL,
+		       0);
+
   sushiv_new_objective(s,0,"fractal",fractal_objective,0);
 
   sushiv_new_panel_2d(s,0,"Mandel/Julia Fractal",4,
 		      (double []){0, .01, .1, 1.0},
 		      (int []){0,-1},
-		      (int []){0,1,2,3,-1},
+		      (int []){0,1,2,3,4,-1},
 		      0);
   
   return 0;



More information about the commits mailing list