aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-07 17:31:30 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:18 +0100
commit33798dda6cce6c5d14df912ba11ff86fb4de0d40 (patch)
tree7c4056cb468053778c99c4a7c2283013797194f9
parent91fcc695e253eb1085b55f0ff0978a9f0379cd8d (diff)
Remove hardcoded resolution limit in find_intersections()
-rw-r--r--src/detector.c26
-rw-r--r--src/detector.h2
-rw-r--r--src/geometry.c3
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; fs<image->width; fs++ ) {
+ for ( ss=0; ss<image->height; 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);