aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-17 15:04:37 +0100
committerThomas White <taw@physics.org>2010-02-17 15:04:37 +0100
commit490807b4f205cc7de810e946b87631b5973cef72 (patch)
treef429a1d04c64a25ebd0b7c065aaaf021f8f18553
parentc7c73d91c8eb909ecd2e8911ee2dd051d398412b (diff)
Do peak locations in floating point
-rw-r--r--src/displaywindow.c8
-rw-r--r--src/render.c8
2 files changed, 7 insertions, 9 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index d7f66002..5831d034 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -411,22 +411,22 @@ static void load_features_from_file(struct image *image, const char *filename)
do {
char line[1024];
- int x, y, r, d;
- float df;
+ float x, y, d, df;
+ int r;
rval = fgets(line, 1023, fh);
if ( rval == NULL ) continue;
chomp(line);
/* Try long format (output of pattern_sim --near-bragg) */
- r = sscanf(line, "%i %i %i %f (at %i,%i)",
+ r = sscanf(line, "%f %f %f %f (at %f,%f)",
&d, &d, &d, &df, &x, &y);
if ( r == 6 ) {
image_add_feature(image->features, x, y, image, 1.0);
continue;
}
- r = sscanf(line, "%i %i", &x, &y);
+ r = sscanf(line, "%f %f", &x, &y);
if ( r != 2 ) continue;
image_add_feature(image->features, x, y, image, 1.0);
diff --git a/src/render.c b/src/render.c
index 3586b962..9bdb9a75 100644
--- a/src/render.c
+++ b/src/render.c
@@ -174,16 +174,14 @@ static void show_marked_features(struct image *image, guchar *data,
for ( i=0; i<image_feature_count(image->features); i++ ) {
struct imagefeature *f;
- int x, y;
+ float x, y;
double th;
f = image_get_feature(image->features, i);
if ( f == NULL ) continue;
- x = f->x; y = f->y;
-
- x /= binning;
- y /= binning;
+ x = f->x / (float)binning;
+ y = f->y / (float)binning;
for ( th=0; th<2*M_PI; th+=M_PI/40.0 ) {