diff options
author | Thomas White <taw@physics.org> | 2011-10-07 16:31:21 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:39 +0100 |
commit | 986f4673fd2a2e77688f22fea83fd7b6879f9b6b (patch) | |
tree | 71288c82cfc12a59b7e0e6543f1ae2c132aff724 | |
parent | 1ad18276acfa02a31a80e62d889f023d19242a9e (diff) |
"Fix" divergence gradient
-rw-r--r-- | src/post-refinement.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c index aa6012f8..b96aba66 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -85,6 +85,7 @@ double gradient(struct image *image, int k, Reflection *refl, double r) double r1, r2, p; int clamp_low, clamp_high; double klow, khigh; + double gr; get_symmetric_indices(refl, &hs, &ks, &ls); @@ -130,9 +131,18 @@ double gradient(struct image *image, int k, Reflection *refl, double r) switch ( k ) { case REF_DIV : - nom = sqrt(2.0) * ds * sin(image->div/2.0); - den = sqrt(1.0 - cos(image->div/2.0)); - return (nom/den) * g; + gr = 0.0; + if ( clamp_low == 0 ) { + nom = sqrt(2.0) * ds * sin(image->div/2.0); + den = sqrt(1.0 - cos(image->div/2.0)); + gr -= (nom/den) * g; + } + if ( clamp_high == 0 ) { + nom = sqrt(2.0) * ds * sin(image->div/2.0); + den = sqrt(1.0 - cos(image->div/2.0)); + gr += (nom/den) * g; + } + return gr / 4.0; /* FIXME: Shameless fudge factor */ case REF_R : g = 0.0; |