[xiph-commits] r12293 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Jan 2 21:16:06 PST 2007
Author: xiphmont
Date: 2007-01-02 21:16:04 -0800 (Tue, 02 Jan 2007)
New Revision: 12293
Modified:
trunk/sushivision/example_fractal.c
trunk/sushivision/panel-1d.c
Log:
Add a fun new objective to fractal demo to illustrate one function -> two objective mapping
Modified: trunk/sushivision/example_fractal.c
===================================================================
--- trunk/sushivision/example_fractal.c 2007-01-03 02:59:15 UTC (rev 12292)
+++ trunk/sushivision/example_fractal.c 2007-01-03 05:16:04 UTC (rev 12293)
@@ -32,17 +32,22 @@
double z, zi, zz;
const double c=d[0],ci=d[1];
- *ret=NAN;
+ ret[0]=NAN;
+ ret[1]=1.;
+
z = d[2]; zi = d[3];
for(i=0;i<max_iter;i++){
zz = z*z - zi*zi + c;
zi = 2.0*z*zi + ci;
z = zz;
if (z*z + zi*zi > 4.0){
- *ret = (double)i/max_iter;
+ ret[0] = (double)i/max_iter;
+ ret[1] = NAN;
return;
}
}
+
+ ret[1] = sqrt(z*z + zi*zi)/4.;
}
int sushiv_submain(int argc, char *argv[]){
@@ -73,23 +78,27 @@
NULL,0);
sushiv_dimension_set_value(s,4,1,10000);
- sushiv_new_function(s, 0, 5, 1, fractal_objective, 0);
+ sushiv_new_function(s, 0, 5, 2, fractal_objective, 0);
- sushiv_new_objective_Y(s,0,"fractal",
+ sushiv_new_objective_Y(s,0,"outer",
5,(double []){0, .001, .01, .1, 1.0},
0,0,0);
+ sushiv_new_objective_Y(s,1,"inner",
+ 5,(double []){0, .001, .01, .1, 1.0},
+ 0,1,0);
+
sushiv_new_panel_2d(s,0,"Mandel/Julia Fractal",
- (int []){0,-1},
+ (int []){0,1,-1},
(int []){0,1,2,3,4,-1},
0);
sushiv_new_panel_1d_linked(s,1,"X Slice",s->objective_list[0]->scale,
- (int []){0,-1},
+ (int []){0,1,-1},
0,0);
sushiv_new_panel_1d_linked(s,2,"Y Slice",s->objective_list[0]->scale,
- (int []){0,-1},
+ (int []){0,1,-1},
0,SUSHIV_PANEL_LINK_Y | SUSHIV_PANEL_FLIP);
return 0;
Modified: trunk/sushivision/panel-1d.c
===================================================================
--- trunk/sushivision/panel-1d.c 2007-01-03 02:59:15 UTC (rev 12292)
+++ trunk/sushivision/panel-1d.c 2007-01-03 05:16:04 UTC (rev 12293)
@@ -69,7 +69,7 @@
cairo_t *c = cairo_create(cs);
if(plot){
- int xi,i;
+ int xi,i,j;
int dw = p1->data_size;
double h = p1->panel_h;
double r = (p1->flip?p1->panel_w:p1->panel_h);
@@ -95,12 +95,12 @@
}
/* by objective */
- for(i=0;i<p->objectives;i++){
- double *data_vec = p1->data_vec[i];
- double alpha = slider_get_value(p1->alpha_scale[i],0);
- int linetype = p1->linetype[i];
- int pointtype = p1->pointtype[i];
- u_int32_t color = mapping_calc(p1->mappings+i,1.,0);
+ for(j=0;j<p->objectives;j++){
+ double *data_vec = p1->data_vec[j];
+ double alpha = slider_get_value(p1->alpha_scale[j],0);
+ int linetype = p1->linetype[j];
+ int pointtype = p1->pointtype[j];
+ u_int32_t color = mapping_calc(p1->mappings+j,1.,0);
if(data_vec){
double xv[dw];
More information about the commits
mailing list