From c7c73d91c8eb909ecd2e8911ee2dd051d398412b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 17 Feb 2010 15:04:14 +0100 Subject: Fix obvious mapping bugs --- src/index.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/index.c') diff --git a/src/index.c b/src/index.c index 4e8460f6..49e21bb7 100644 --- a/src/index.c +++ b/src/index.c @@ -50,11 +50,13 @@ int map_position(struct image *image, double dx, double dy, x = ((double)dx - image->det.panels[p].cx); y = ((double)dy - image->det.panels[p].cy); found = 1; + break; } } if ( !found ) { - ERROR("No mapping found for %f,%f\n", dx, dy); - return 0; + ERROR("No mapping found for %f,%f (map_position)\n", dx, dy); + *rx = 0.0; *ry = 0.0; *rz = 0.0; + return 1; } /* Convert pixels to metres */ @@ -113,13 +115,14 @@ void index_pattern(struct image *image, IndexingMethod indm, int no_match) for ( i=0; ifeatures); i++ ) { struct imagefeature *f; + int c; f = image_get_feature(image->features, i); if ( f == NULL ) continue; - if ( map_position(image, f->x, f->y, &f->rx, &f->ry, &f->rz) ) { - nc++; - } + c = map_position(image, f->x, f->y, &f->rx, &f->ry, &f->rz); + if ( c != 0 ) nc++; + } if ( nc ) { ERROR("Failed to map %i reflections\n", nc); -- cgit v1.2.3