Rev 209 | Rev 234 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 209 | Rev 221 | ||
---|---|---|---|
Line 116... | Line 116... | ||
116 | h2[h2d]->nx = nx; |
116 | h2[h2d]->nx = nx; |
117 | h2[h2d]->ny = ny; |
117 | h2[h2d]->ny = ny; |
118 | h2[h2d]->minx = minx; |
118 | h2[h2d]->minx = minx; |
119 | h2[h2d]->miny = miny; |
119 | h2[h2d]->miny = miny; |
120 | 120 | ||
121 | h2[h2d]->stepx = (nx> |
121 | h2[h2d]->stepx = (nx>0)?(maxx-minx)/(nx):0; |
122 | h2[h2d]->stepy = (nx> |
122 | h2[h2d]->stepy = (nx>0)?(maxy-miny)/(ny):0; |
123 | 123 | ||
124 | h2[h2d]->size = h2[h2d]->nx*h2[h2d]->ny*sizeof(double); |
124 | h2[h2d]->size = h2[h2d]->nx*h2[h2d]->ny*sizeof(double); |
125 | h2[h2d]->data = (double *) malloc(h2[h2d]->size); |
125 | h2[h2d]->data = (double *) malloc(h2[h2d]->size); |
126 | h2[h2d]->len=sizeof(H2D)-sizeof(double *)+h2[h2d]->size; |
126 | h2[h2d]->len=sizeof(H2D)-sizeof(double *)+h2[h2d]->size; |
127 | H2D_Clear(h2d); |
127 | H2D_Clear(h2d); |
Line 129... | Line 129... | ||
129 | //Printf("InitH2D 0x%x\n", h2d ); |
129 | //Printf("InitH2D 0x%x\n", h2d ); |
130 | return 0; |
130 | return 0; |
131 | } |
131 | } |
132 | 132 | ||
133 | double _VI_FUNC H2D_GetXBinCenter(int h2d,int xbin) { |
133 | double _VI_FUNC H2D_GetXBinCenter(int h2d,int xbin) { |
134 | return h2[h2d]->minx+xbin*h2[h2d]->stepx; |
134 | return h2[h2d]->minx+(xbin+0.5)*h2[h2d]->stepx; |
135 | } |
135 | } |
136 | 136 | ||
137 | double _VI_FUNC H2D_GetYBinCenter(int h2d,int ybin) { |
137 | double _VI_FUNC H2D_GetYBinCenter(int h2d,int ybin) { |
138 | return h2[h2d]->miny+ybin*h2[h2d]->stepy; |
138 | return h2[h2d]->miny+(ybin+0.5)*h2[h2d]->stepy; |
139 | } |
139 | } |
140 | 140 | ||
141 | int _VI_FUNC H2D_Write2File(int h2d,FILE *fp) { |
141 | int _VI_FUNC H2D_Write2File(int h2d,FILE *fp) { |
142 | 142 | ||
143 | if (!fp) return -1; |
143 | if (!fp) return -1; |
Line 290... | Line 290... | ||
290 | H2D_GetData(histogram), |
290 | H2D_GetData(histogram), |
291 | H2D_GetNbinsX(histogram), |
291 | H2D_GetNbinsX(histogram), |
292 | H2D_GetNbinsY(histogram), |
292 | H2D_GetNbinsY(histogram), |
293 | VAL_DOUBLE, |
293 | VAL_DOUBLE, |
294 | H2D_GetStepY(histogram), |
294 | H2D_GetStepY(histogram), |
295 |
|
295 | H2D_GetYBinCenter(histogram,0), |
296 | H2D_GetStepX(histogram), |
296 | H2D_GetStepX(histogram), |
297 |
|
297 | H2D_GetXBinCenter(histogram,0), |
298 | colormap->array, |
298 | colormap->array, |
299 | colormap->HiColor, |
299 | colormap->HiColor, |
300 | colormap->numberofColors, 1, 0); |
300 | colormap->numberofColors, 1, 0); |
301 | RefreshGraph (panel, control); |
301 | RefreshGraph (panel, control); |
302 | 302 |