diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-09-04 13:46:07 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-09-04 13:46:07 +0000 |
commit | d91e23905783bdb36c7d1c982a1cf890ae5ce1fd (patch) | |
tree | 7d5619bcf6d579a56466b5306ac564015e5e2168 /src/reproject.c | |
parent | 6c1e994a08af75532f4db7861f7921b5f2032583 (diff) |
Working reprojection
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@109 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r-- | src/reproject.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/reproject.c b/src/reproject.c index 5594451..efd32c9 100644 --- a/src/reproject.c +++ b/src/reproject.c @@ -40,7 +40,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect double nx, ny, nz; double xt, yt, zt; double a, b, c; - double s1, s2, s; + double A1, A2, s1, s2, s; /* Get the coordinates of the reciprocal lattice point */ xl = reflection->x; @@ -49,18 +49,21 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect /* Now calculate the (normalised) incident electron wavevector */ xt = 0; - yt = sin(tilt); - zt = cos(tilt); + yt = sin(tilt); + zt = cos(tilt); nx = xt*cos(omega) + yt*-sin(omega); ny = xt*sin(omega) + yt*cos(omega); nz = zt; /* Next, solve the relrod equation to calculate the excitation error */ a = 1.0; - b = 2.0*(xl*nx + yl*ny + zl*nz - nz/image.lambda); - c = xl*xl + yl*yl + zl*zl - 2.0*zl/image.lambda; - s1 = (-b + sqrt(b*b-4.0*a*c))/(2.0*a); - s2 = (-b - sqrt(b*b-4.0*a*c))/(2.0*a); + b = -2.0*(xl*nx + yl*ny + zl*nz); + c = xl*xl + yl*yl + zl*zl - 1.0/(image.lambda*image.lambda); + A1 = (-b + sqrt(b*b-4.0*a*c))/(2.0*a); + A2 = (-b - sqrt(b*b-4.0*a*c))/(2.0*a); + s1 = 1.0/image.lambda - A1; + s2 = 1.0/image.lambda - A2; + if ( fabs(s1) < fabs(s2) ) s = s1; else s = s2; /* Skip this reflection if s is large */ |