aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);