aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/detgeom.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-10 16:48:28 +0100
committerThomas White <taw@physics.org>2021-03-11 15:59:11 +0100
commitd6db66c2d57be8071465cfcac70baea4499c99df (patch)
tree96df69be8af0e959b6ed38c0bbb2a4377030bb79 /libcrystfel/src/detgeom.c
parente79af3cbb5f02528e403488e2a3bc7902fb3f382 (diff)
detgeom_transform_coords: Take an additional detector shift
This allows the refined detector position to be used in a lot of places.
Diffstat (limited to 'libcrystfel/src/detgeom.c')
-rw-r--r--libcrystfel/src/detgeom.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c
index 0ddbcbf4..5612a225 100644
--- a/libcrystfel/src/detgeom.c
+++ b/libcrystfel/src/detgeom.c
@@ -45,14 +45,15 @@
void detgeom_transform_coords(struct detgeom_panel *p,
double fs, double ss,
double wavelength,
+ double dx, double dy,
double *r)
{
double xs, ys, zs;
double fac;
/* Calculate 3D position of given position, in pixels */
- xs = p->cnx + fs*p->fsx + ss*p->ssx;
- ys = p->cny + fs*p->fsy + ss*p->ssy;
+ xs = p->cnx + fs*p->fsx + ss*p->ssx + dx*p->pixel_pitch;
+ ys = p->cny + fs*p->fsy + ss*p->ssy + dy*p->pixel_pitch;
zs = p->cnz + fs*p->fsz + ss*p->ssz;
fac = wavelength * sqrt(xs*xs + ys*ys + zs*zs);
@@ -82,16 +83,16 @@ static double panel_max_res(struct detgeom_panel *p,
double r[3];
double max_res = 0.0;
- detgeom_transform_coords(p, 0, 0, wavelength, r);
+ detgeom_transform_coords(p, 0, 0, wavelength, 0.0, 0.0, r);
max_res = biggest(max_res, modulus(r[0], r[1], r[2]));
- detgeom_transform_coords(p, 0, p->h, wavelength, r);
+ detgeom_transform_coords(p, 0, p->h, wavelength, 0.0, 0.0, r);
max_res = biggest(max_res, modulus(r[0], r[1], r[2]));
- detgeom_transform_coords(p, p->w, 0, wavelength, r);
+ detgeom_transform_coords(p, p->w, 0, wavelength, 0.0, 0.0, r);
max_res = biggest(max_res, modulus(r[0], r[1], r[2]));
- detgeom_transform_coords(p, p->w, p->h, wavelength, r);
+ detgeom_transform_coords(p, p->w, p->h, wavelength, 0.0, 0.0, r);
max_res = biggest(max_res, modulus(r[0], r[1], r[2]));
return max_res;