aboutsummaryrefslogtreecommitdiff
path: root/src/intensities.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-04 11:58:02 +0100
committerThomas White <taw@physics.org>2009-12-04 12:01:37 +0100
commite0d9ab3636eaf462a820f9e0648ef682fa0e3bb5 (patch)
tree1dff2061480b38abeacc5724858fadadcc4287e0 /src/intensities.c
parentfe414fa905261a11b1af2055c1e871d2d7f826f2 (diff)
Fix indexing for intensity output
Diffstat (limited to 'src/intensities.c')
-rw-r--r--src/intensities.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/intensities.c b/src/intensities.c
index ae8667cb..1c6bb4ae 100644
--- a/src/intensities.c
+++ b/src/intensities.c
@@ -66,7 +66,8 @@ void output_intensities(struct image *image)
for ( x=0; x<image->width; x++ ) {
for ( y=0; y<image->height; y++ ) {
- double hd, kd, ld;
+ double hd, kd, ld; /* Indices with decimal places */
+ double dh, dk, dl; /* Distances in h,k,l directions */
signed int h, k, l;
struct threevec q;
double dist;
@@ -83,10 +84,11 @@ void output_intensities(struct image *image)
k = (signed int)rint(kd);
l = (signed int)rint(ld);
- dist = sqrt(pow(fmod(hd, 1.0), 2.0) + pow(fmod(kd, 1.0), 2.0)
- + pow(fmod(ld, 1.0), 2.0));
-
- if ( dist > 0.2 ) continue;
+ dh = hd - h;
+ dk = kd - k;
+ dl = ld - l;
+ dist = sqrt(pow(dh, 2.0) + pow(dk, 2.0) + pow(dl, 2.0));
+ if ( dist > 0.1 ) continue;
for ( j=0; j<n_hits; j++ ) {
if ( (hits[j].h == h) && (hits[j].k == k)