diff options
author | Thomas White <taw@physics.org> | 2023-07-10 11:59:42 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-07-28 13:22:05 +0200 |
commit | 59709a8fb3b3f39fef4b2f4e97ad1b25a9358c8a (patch) | |
tree | a885b2eb0931c92e8a1e727dca942dbfd57a7aaa /libcrystfel/src/utils.c | |
parent | 4476b7b18e263a70356fa93b257e7a2a3439c569 (diff) |
Move rotate2d to utils
Diffstat (limited to 'libcrystfel/src/utils.c')
-rw-r--r-- | libcrystfel/src/utils.c | 9 |
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); |