diff options
Diffstat (limited to 'geom.hpp')
-rw-r--r-- | geom.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,5 +1,6 @@ #pragma once +#include <stdlib.h> #include <math.h> #include <algorithm> #include <assert.h> @@ -7,7 +8,12 @@ #define EPSILON 1e-6 #define abs(x) ((x)<0?-(x):(x)) -double canon_angle(double ref, double move_it){ +inline double frand(double a, double b) { + double r = ((double)rand()) / ((double)RAND_MAX); + return r * (b - a) + a; +} + +inline double canon_angle(double ref, double move_it){ while (ref>move_it) move_it += 2*M_PI; while (move_it >= ref + 2*M_PI) move_it -= 2*M_PI; return move_it ; |