summaryrefslogtreecommitdiff
path: root/src/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math.c')
-rw-r--r--src/math.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/math.c b/src/math.c
index 82328b7..3993223 100644
--- a/src/math.c
+++ b/src/math.c
@@ -49,6 +49,10 @@ real distance2(c2_t p1,c2_t p2) {
return sqrtl(( (p1.x-p2.x)*(p1.x-p2.x) )+( (p1.y-p2.y)*(p1.y-p2.y) ));
}
+degrees r2d(radians r) {
+ return (degrees){(r.r * (real)180 / M_PIl) };
+}
+
radians d2r(degrees d) {
while(d.d<0) d.d+=360;
return (radians){(real)(d.d%360) / (real)180 * M_PIl};