From 645c6a1cf40b9075d7ff463239b1a40deca0effa Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Jun 2011 17:41:16 +0200 Subject: Tidy up formatting --- src/detector.c | 143 ++++++++++++++++++--------------------------------------- 1 file changed, 44 insertions(+), 99 deletions(-) (limited to 'src/detector.c') diff --git a/src/detector.c b/src/detector.c index b432c1a2..6c311f9d 100644 --- a/src/detector.c +++ b/src/detector.c @@ -32,67 +32,20 @@ static int atob(const char *a) return atoi(a); } -/* No longer used. See dir_conv() -static int dir_conv(const char *a, double *sx, double *sy) -{ - if ( strcmp(a, "-x") == 0 ) { - *sx = -1; *sy = 0; - return 0; - } - if ( strcmp(a, "x") == 0 ) { - *sx = 1; *sy = 0; - return 0; - } - if ( strcmp(a, "+x") == 0 ) { - *sx = 1; *sy = 0; - return 0; - } - if ( strcmp(a, "-y") == 0 ) { - *sx = 0; *sy = -1; - return 0; - } - if ( strcmp(a, "y") == 0 ) { - *sx = 0; *sy = 1; - return 0; - } - if ( strcmp(a, "+y") == 0 ) { - *sx = 0; *sy = 1; - return 0; - } - return 1; -} */ - -/* Not necessary!!! I can remove white space earlier */ -/*static void remove_white_space(char * str ) { - int nl, i=0, j=0; - char **bits; - - n1 = assplode(*a, " \t", &bits, ASSPLODE_NONE); - - for(i = 0; i < strlen(bits); i++ ) { - for (ii = 0; ii < strlen(bits[0]); ii++){ - str[j] = bits[i][ii]; - j++; - } - } - -} */ -static int dir_conv_extract_coeff(const char *a, int *sign, int *axis, double *coeff) +static int dir_conv_extract_coeff(const char *a, int *sign, int *axis, + double *coeff) { int len; - len = strlen(a); int index = 1; char tempstr[len]; double test=0.0; - int i=0; + int i; - for (i=0;i 2) { + + } else if ( (len - index) > 2 ) { if (index == 0 ) { strncpy(tempstr,a,len-2); @@ -114,55 +69,49 @@ static int dir_conv_extract_coeff(const char *a, int *sign, int *axis, double *c strncpy(tempstr,a+1,len-2); } - /*for ( i = 0; i 3) { - //strcat(bits[2]," "); - for (i=3; i 3 ) { + for ( i=3; in_panels == -1 ) { @@ -898,6 +839,7 @@ struct detector *get_detector_geometry(const char *filename) } } } + out: det->max_fs = max_fs; det->max_ss = max_ss; @@ -909,8 +851,7 @@ out: double d; p = &det->panels[i]; - //printf("p->fsx*p->ssy %g ; p->fsx %g; p->ssy %g ;\n",p->fsx*p->ssy,p->fsx,p->ssy ); - //printf("p->fsy*p->ssx %g ; p->fsy %g; p->ssx %g ;\n",p->fsy*p->ssx,p->fsy,p->ssx ); + if ( p->fsx*p->ssy == p->ssx*p->fsy ) { ERROR("Panel %i transformation singular.\n", i); reject = 1; @@ -1086,6 +1027,7 @@ double largest_q(struct image *image) return qmax; } + double smallest_q(struct image *image) { int fs, ss; @@ -1110,6 +1052,7 @@ double smallest_q(struct image *image) return qmin; } + void get_pixel_extents(struct detector *det, double *min_x, double *min_y, double *max_x, double *max_y) @@ -1193,7 +1136,8 @@ int write_detector_geometry(const char *filename, struct detector *det) signy=' '; } - fprintf(fh, "%s/fs = %C%fx%C%fy\n", p->name, signx, p->fsx,signy, p->fsy); + fprintf(fh, "%s/fs = %C%fx%C%fy\n", p->name, + signx, p->fsx, signy, p->fsy); if ( p->ssx >= 0 ) { signx='+'; @@ -1207,7 +1151,8 @@ int write_detector_geometry(const char *filename, struct detector *det) signy=' '; } - fprintf(fh, "%s/ss = %C%fx%C%fy\n", p->name, signx,p->ssx,signy,p->ssy); + fprintf(fh, "%s/ss = %C%fx%C%fy\n", p->name, + signx, p->ssx, signy, p->ssy); fprintf(fh, "%s/corner_x = %g\n", p->name, p->cnx); fprintf(fh, "%s/corner_y = %g\n", p->name, p->cny); -- cgit v1.2.3