aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-08-24 18:40:28 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:56 +0100
commit4c299df41d3a74812c288d4fa864c8f13a8a73dd (patch)
treef465dfe9cfbda4027eee5b53c4b3f4b6af92cb78
parente1211cba640110a5336e395c6d2319cf7c83de0e (diff)
Attempt to speed up template indexing a bit
-rw-r--r--src/templates.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/templates.c b/src/templates.c
index 879fb8b8..d2d4de7b 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -230,15 +230,20 @@ static double integrate_all_rot(struct image *image, struct reflhit *hits,
{
double itot = 0.0;
int i;
+ double cosr, sinr;
+
+ cosr = cos(rot);
+ sinr = sin(rot);
for ( i=0; i<n; i++ ) {
float xp, yp;
- xp = cos(rot)*hits[i].x + sin(rot)*hits[i].y;
- yp = -sin(rot)*hits[i].x + cos(rot)*hits[i].y;
+ xp = cosr*hits[i].x + sinr*hits[i].y;
+ yp = -sinr*hits[i].x + cosr*hits[i].y;
+
+ itot += fast_integrate_peak(image, rint(xp), rint(yp));
- itot += fast_integrate_peak(image, xp, yp);
}
return itot;