From 86c55dc5590ed44e61d4fa95eec2273cdf13623f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 29 Mar 2010 16:17:17 +0200 Subject: integrate_peak(): Handle the situation where there is no intensity --- src/peaks.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/peaks.c') diff --git a/src/peaks.c b/src/peaks.c index 02ad6492..cf0b4ae0 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -160,9 +160,16 @@ static void integrate_peak(struct image *image, int xp, int yp, } } - *xc = (float)xct / total; - *yc = (float)yct / total; - *intensity = total; + /* The centroid is excitingly undefined if there is no intensity */ + if ( total != 0 ) { + *xc = (float)xct / total; + *yc = (float)yct / total; + *intensity = total; + } else { + *xc = (float)xp; + *yc = (float)yp; + *intensity = 0; + } } -- cgit v1.2.3