aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/utils.c')
-rw-r--r--libcrystfel/src/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c
index 262a32cc..10e4c38e 100644
--- a/libcrystfel/src/utils.c
+++ b/libcrystfel/src/utils.c
@@ -470,6 +470,15 @@ void progress_bar(int val, int total, const char *text)
}
+void rotate2d(double *x, double *y, double cx, double cy, double ang)
+{
+ double nx, ny;
+ nx = cx + (*x-cx)*cos(ang) - (*y-cy)*sin(ang);
+ ny = cy + (*x-cx)*sin(ang) + (*y-cy)*cos(ang);
+ *x = nx; *y = ny;
+}
+
+
double random_flat(gsl_rng *rng, double max)
{
return max * gsl_rng_uniform(rng);