Beispiel #1
0
void bbc(int plt=0){
    gStyle->SetOptStat(0);
    if(plt==0 || plt==1){
	plot1d(c1,"BBCE");
	plot1d(c2,"BBCMult");
	plot1d(c3,"TOF");
    }
    if(plt==0 || plt==2){
	plot2d(c1,"BBC_BBCMult");
	plot2d(c2,"BBC_TOF");
	plot2d(c3,"BBCMult_TOF");	
    }
    if(plt==0 || plt==3){
	plot2d(c1,"TOF_TOF");
    }
}
Beispiel #2
0
// expects a kanji with some strokes
// fills between each two points of a stroke
// intermediate "filler" points using
// bresenhams line algo to increase the
// resolution
kanji raster(kanji k) {
    // print_kanji(k);
    kanji k_raster;
    k_raster.kji = k.kji;
    k_raster.c_strokes = 0;
    k_raster.c_points = 0;
    k_raster.xy = 0;
    for(int i=0;i<k.c_strokes;i++) {
        // plot_dists_i stores in i how many points will exist 
        // between stroke_i[j], stroke_i[j-1]
        int *plot_dists_i = (int*) malloc(sizeof(int)*k.c_points[i]);
        int new_size_of_i = 0;
        point *stroke_i = k.xy[i];
        // for each two consecutive points, count how many points
        // will be needed, store that into plot_dists_i
        // count overall points, and store them in new_size_of_i
        for(int j=0;j<k.c_points[i]-1;j++) {
            point *dummy;            
            int cnt_j_jplus1 = plot2d(stroke_i[j],stroke_i[j+1],true,0,dummy);
            if(j==0) {              
                plot_dists_i[j] = cnt_j_jplus1;    
            } else {
                plot_dists_i[j] = plot_dists_i[j-1] + cnt_j_jplus1;
            }
            new_size_of_i += cnt_j_jplus1;
        }
        // 
        // printf("looped, new_size: %i\n",new_size_of_i);
        point *new_stroke = (point*) malloc(sizeof(point) * new_size_of_i);
        // printf("ok\n");
        for(int j=0;j<k.c_points[i]-1;j++) {
            if(j==0) {
               // printf("calling plot2d: plot_dists_i[j]=%i\n",0);
               plot2d(stroke_i[j],stroke_i[j+1],false,0,new_stroke);
            } else {
               // printf("calling plot2d: plot_dists_i[j]=%i\n",plot_dists_i[j-1]);
               plot2d(stroke_i[j],stroke_i[j+1],false,plot_dists_i[j-1],new_stroke);
            }
        }
        // printf("add stroke\n");
        add_stroke(&k_raster,new_stroke,new_size_of_i);
        free(plot_dists_i);
    }
    // print_kanji(k_raster);
    return k_raster;
}
Beispiel #3
0
void test_plot2d() {
    
    point p0;
    point p1;
    point p2;
    point p3;
    p0.x = p0.y = 0;
    p1.x = 0; p1.y = 20;
    p2.x = 20; p2.y = 0;
    p3.x = 20; p3.y = 20;
    int numbers = -1;
    point *strokes;
    numbers = plot2d(p3, p2, true, 0, strokes);
    printf("numbers needed:%i\n",numbers);
    strokes = (point*) malloc(sizeof(point) *numbers);
    numbers = plot2d(p2,p3,false,0,strokes);
    for(int i=0;i<numbers;i++) {
        printf("(%i,%i) ",strokes[i].x,strokes[i].y);
    }
    printf("\n");
}
Beispiel #4
0
int
main(){
  OD  od0(0,10);
  OD  od1(0,128);
  OD  od2(0,255);
  OD  od3(200,100);
  
  OD  od41(0,255);
  OD2 od4 (od41,100,15);
  
  plot2d(od0,
	 od1,
	 od2,
	 od3,
	 od4,
	 0.0,100.0);
  return 0;
}