From 33798dda6cce6c5d14df912ba11ff86fb4de0d40 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 7 Mar 2011 17:31:30 +0100 Subject: Remove hardcoded resolution limit in find_intersections() --- src/detector.c | 26 ++++++++++++++++++++++++++ src/detector.h | 2 ++ src/geometry.c | 3 +-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/detector.c b/src/detector.c index dfff82a3..a8a5c26e 100644 --- a/src/detector.c +++ b/src/detector.c @@ -661,6 +661,32 @@ static void check_extents(struct panel p, double *min_x, double *min_y, } +double largest_q(struct image *image) +{ + int fs, ss; + double ttm = 0.0; + double qmax = 0.0; + + for ( fs=0; fswidth; fs++ ) { + for ( ss=0; ssheight; ss++ ) { + + struct rvec q; + double tt; + + q = get_q(image, fs, ss, &tt, 1.0/image->lambda); + + if ( tt > ttm ) { + qmax = modulus(q.u, q.v, q.w); + ttm = tt; + } + + } + } + + return qmax; +} + + void get_pixel_extents(struct detector *det, double *min_x, double *min_y, double *max_x, double *max_y) diff --git a/src/detector.h b/src/detector.h index 7db90e21..3a4948a9 100644 --- a/src/detector.h +++ b/src/detector.h @@ -83,4 +83,6 @@ extern struct detector *copy_geom(const struct detector *in); extern int reverse_2d_mapping(double x, double y, double *pfs, double *pss, struct detector *det); +extern double largest_q(struct image *image); + #endif /* DETECTOR_H */ diff --git a/src/geometry.c b/src/geometry.c index f8b74148..2fc44445 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -248,8 +248,7 @@ RefList *find_intersections(struct image *image, UnitCell *cell, &bsx, &bsy, &bsz, &csx, &csy, &csz); - /* FIXME: Get this from image */ - mres = 1.0 / 8.0e-10; /* 8 Angstroms */ + mres = largest_q(image); hmax = mres / modulus(asx, asy, asz); kmax = mres / modulus(bsx, bsy, bsz); lmax = mres / modulus(csx, csy, csz); -- cgit v1.2.3