aboutsummaryrefslogtreecommitdiff
path: root/src/diffraction.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-05-28 17:17:57 +0200
committerThomas White <taw@physics.org>2010-05-28 17:17:57 +0200
commitd5899847b31eaaffd676f23dbc3538f06cc2faec (patch)
tree1307f04c9a0d46e54a684a5b1a9f69e1ab436754 /src/diffraction.c
parent361bbacf1b17cdf57b8870dc8b560ff1a6831b1f (diff)
Fix WEIRD Valgrind warnings
Diffstat (limited to 'src/diffraction.c')
-rw-r--r--src/diffraction.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/diffraction.c b/src/diffraction.c
index 1960f786..8b245589 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -267,6 +267,28 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys,
}
+double get_tt(struct image *image, unsigned int xs, unsigned int ys)
+{
+ float r;
+ float rx = 0.0;
+ float ry = 0.0;
+ struct panel *p;
+
+ const unsigned int x = xs;
+ const unsigned int y = ys; /* Integer part only */
+
+ p = find_panel(&image->det, x, y);
+
+ rx = ((float)xs - p->cx) / p->res;
+ ry = ((float)ys - p->cy) / p->res;
+
+ /* Calculate q-vector for this sub-pixel */
+ r = sqrt(pow(rx, 2.0) + pow(ry, 2.0));
+
+ return atan2(r, p->clen);
+}
+
+
void get_diffraction(struct image *image, int na, int nb, int nc,
const double *intensities, const unsigned int *counts,
UnitCell *cell, int do_water, GradientMethod m)