aboutsummaryrefslogtreecommitdiff
path: root/src/render_hkl.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-07-28 08:09:55 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:54 +0100
commit599ac05b0681404d596a11f2fb36ed0afd7f3694 (patch)
tree9ed461d3bc568c3b466c59744eaba6c0fc0bb002 /src/render_hkl.c
parentd2d5dbd980faa87f0763f26353b476f2aa65e30b (diff)
render_hkl: Simplify and fix
Diffstat (limited to 'src/render_hkl.c')
-rw-r--r--src/render_hkl.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/src/render_hkl.c b/src/render_hkl.c
index ea2af1e7..91ec73d7 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -190,52 +190,39 @@ static void draw_circles(signed int xh, signed int xk, signed int xl,
double u, v, val, res;
signed int h, k, l;
+ signed int he, ke, le;
h = xi*xh + yi*yh;
k = xi*xk + yi*yk;
l = xi*xl + yi*yl;
/* Got this reflection? */
- if ( find_unique_equiv(items, h, k, l, sym, &h, &k, &l) == 0 ) {
- continue;
- }
+ if ( find_unique_equiv(items, h, k, l, sym,
+ &he, &ke, &le) == 0 ) continue;
switch ( wght ) {
case WGHT_I :
- val = lookup_intensity(ref, h, k, l);
+ val = lookup_intensity(ref, he, ke, le);
break;
case WGHT_SQRTI :
- val = lookup_intensity(ref, h, k, l);
+ val = lookup_intensity(ref, he, ke, le);
val = (val>0.0) ? sqrt(val) : 0.0;
break;
case WGHT_COUNTS :
- val = lookup_count(counts, h, k, l);
- val /= (float)num_equivs(h, k, l, sym);
+ val = lookup_count(counts, he, ke, le);
+ val /= (float)num_equivs(he, ke, le, sym);
break;
case WGHT_RAWCOUNTS :
- val = lookup_count(counts, h, k, l);
+ val = lookup_count(counts, he, ke, le);
break;
default :
ERROR("Invalid weighting.\n");
abort();
}
- signed int he, ke, le;
- signed int ux, uy, uz;
-
- find_unique_equiv(items, h, k, l, sym, &he, &ke, &le);
-
- /* Calculate the indices in the 2D basis */
- ux = he*bc[0] + ke*bc[1] + le*bc[2];
- uy = he*bc[3] + ke*bc[4] + le*bc[5];
- uz = he*bc[6] + ke*bc[7] + le*bc[8];
-
- /* Reflection in the zone? */
- if ( uz != 0 ) continue;
-
/* Absolute location in image based on 2D basis */
- u = (double)ux*as*sin(theta);
- v = (double)ux*as*cos(theta) + (double)uy*bs;
+ u = (double)xi*as*sin(theta);
+ v = (double)xi*as*cos(theta) + (double)yi*bs;
if ( dctx != NULL ) {
@@ -262,13 +249,13 @@ static void draw_circles(signed int xh, signed int xk, signed int xl,
}
/* Find max indices */
- if ( (uy==0) && (fabs(ux) > *max_ux) )
- *max_ux = fabs(ux);
- if ( (ux==0) && (fabs(uy) > *max_uy) )
- *max_uy = fabs(uy);
+ if ( (yi==0) && (fabs(xi) > *max_ux) )
+ *max_ux = fabs(xi);
+ if ( (xi==0) && (fabs(yi) > *max_uy) )
+ *max_uy = fabs(yi);
/* Find max resolution */
- res = resolution(cell, he, ke, le);
+ res = resolution(cell, h, k, l);
if ( res > *max_res ) *max_res = res;
}