From fc78b8c7c8c8b8c240a2861142627cc3877c26e7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 20 Feb 2010 17:09:54 +0100 Subject: Fix get_q, which was distorting reciprocal space previously --- src/diffraction.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/diffraction.c') diff --git a/src/diffraction.c b/src/diffraction.c index 6df00164..bcfee476 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -141,7 +141,7 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys, unsigned int sampling, float *ttp, float k) { struct rvec q; - float twothetax, twothetay, twotheta, r; + float twotheta, r, az; float rx = 0.0; float ry = 0.0; int p; @@ -164,14 +164,13 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys, /* Calculate q-vector for this sub-pixel */ r = sqrt(pow(rx, 2.0) + pow(ry, 2.0)); - twothetax = atan2(rx, image->det.panels[p].clen); - twothetay = atan2(ry, image->det.panels[p].clen); - twotheta = atan2(r, image->det.panels[p].clen); + twotheta = atan2(r, image->det.panels[p].clen); + az = atan2(ry, rx); if ( ttp != NULL ) *ttp = twotheta; - q.u = k * sin(twothetax); - q.v = k * sin(twothetay); + q.u = k * sin(twotheta)*cos(az); + q.v = k * sin(twotheta)*sin(az); q.w = k - k * cos(twotheta); return quat_rot(q, image->orientation); -- cgit v1.2.3