aboutsummaryrefslogtreecommitdiff
path: root/src/control.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 22:12:26 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 22:12:26 +0000
commit1ed23746f6d27f648e3a5f96bf499823069fd171 (patch)
treea810520b178e9bd0783f978c42d1b63be875cfc2 /src/control.c
parenta7d5360db028fc24547ece8e7a4bc49ecfaa8743 (diff)
Fix really stupid obvious bugs
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@134 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/control.c')
-rw-r--r--src/control.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/control.c b/src/control.c
index 97ad34c..270be6f 100644
--- a/src/control.c
+++ b/src/control.c
@@ -11,6 +11,7 @@
#include <inttypes.h>
#include <stdlib.h>
+#include <math.h>
#include "control.h"
@@ -71,7 +72,7 @@ double control_min_tilt(ControlContext *ctx) {
}
-/* Return the maximum (most negative) tilt angle used */
+/* Return the maximum (most positive) tilt angle used */
double control_max_tilt(ControlContext *ctx) {
int i;
@@ -93,8 +94,8 @@ ImageRecord *control_image_nearest_tilt(ControlContext *ctx, double tilt) {
ImageRecord *im = NULL;
for ( i=0; i<ctx->n_images; i++ ) {
- if ( ctx->images[i].tilt - tilt < dev ) {
- dev = ctx->images[i].tilt - tilt;
+ if ( fabs(ctx->images[i].tilt - tilt) < dev ) {
+ dev = fabs(ctx->images[i].tilt - tilt);
im = &ctx->images[i];
}
}