aboutsummaryrefslogtreecommitdiff
path: root/geom.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'geom.hpp')
-rw-r--r--geom.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/geom.hpp b/geom.hpp
index 62e9642..40d6813 100644
--- a/geom.hpp
+++ b/geom.hpp
@@ -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 ;