diff options
author | Thomas White <taw@physics.org> | 2011-04-12 13:22:28 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:24 +0100 |
commit | ee7136039eb5d43fbd3e8a77cbdb8fea94b98468 (patch) | |
tree | 7b16604eac3525d45715eb172e23dcae2ddf00e3 | |
parent | 8cd01313ac0b438195549d0bd46af4df8c5254c0 (diff) |
Add get_q_for_panel()
-rw-r--r-- | src/detector.c | 31 | ||||
-rw-r--r-- | src/detector.h | 3 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/detector.c b/src/detector.c index 0b4bf2fa..0caf621e 100644 --- a/src/detector.c +++ b/src/detector.c @@ -63,25 +63,18 @@ static int dir_conv(const char *a, double *sx, double *sy) } -struct rvec get_q(struct image *image, double fs, double ss, - double *ttp, double k) +struct rvec get_q_for_panel(struct panel *p, double fs, double ss, + double *ttp, double k) { struct rvec q; double twotheta, r, az; double rx, ry; - struct panel *p; double xs, ys; - /* Determine which panel to use */ - const unsigned int x = fs; - const unsigned int y = ss; - p = find_panel(image->det, x, y); - assert(p != NULL); - /* Convert xs and ys, which are in fast scan/slow scan coordinates, * to x and y */ - xs = (fs-(double)p->min_fs)*p->fsx + (ss-(double)p->min_ss)*p->ssx; - ys = (fs-(double)p->min_fs)*p->fsy + (ss-(double)p->min_ss)*p->ssy; + xs = fs*p->fsx + ss*p->ssx; + ys = fs*p->fsy + ss*p->ssy; rx = (xs + p->cnx) / p->res; ry = (ys + p->cny) / p->res; @@ -101,6 +94,22 @@ struct rvec get_q(struct image *image, double fs, double ss, } +struct rvec get_q(struct image *image, double fs, double ss, + double *ttp, double k) +{ + struct panel *p; + const unsigned int fsi = fs; + const unsigned int ssi = ss; /* Explicit rounding */ + + /* Determine which panel to use */ + p = find_panel(image->det, fsi, ssi); + assert(p != NULL); + + return get_q_for_panel(p, fs-(double)p->min_fs, ss-(double)p->min_ss, + ttp, k); +} + + int in_bad_region(struct detector *det, double fs, double ss) { double rx, ry; diff --git a/src/detector.h b/src/detector.h index 86e7eea3..fce60ff6 100644 --- a/src/detector.h +++ b/src/detector.h @@ -86,6 +86,9 @@ struct detector extern struct rvec get_q(struct image *image, double fs, double ss, double *ttp, double k); +extern struct rvec get_q_for_panel(struct panel *p, double fs, double ss, + double *ttp, double k); + extern double get_tt(struct image *image, double xs, double ys); extern int in_bad_region(struct detector *det, double fs, double ss); |