From 983fae140a1e162d947eab8b8a0d9acba291d3a8 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 28 Jan 2023 22:16:25 +0000 Subject: initial public release. --- util.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 util.c (limited to 'util.c') diff --git a/util.c b/util.c new file mode 100644 index 0000000..bd865df --- /dev/null +++ b/util.c @@ -0,0 +1,29 @@ +#include +#include +#include +#include "dat.h" +#include "fns.h" + +double +round(double n) +{ + return floor(n + 0.5); +} + +Point +rotatept(Point p, double θ, Point c) +{ + Point r; + + p = subpt(p, c); + r.x = round(p.x*cos(θ) - p.y*sin(θ)); + r.y = round(p.x*sin(θ) + p.y*cos(θ)); + r = addpt(r, c); + return r; +} + +double +hypot3(double x, double y, double z) +{ + return hypot(x, hypot(y, z)); +} -- cgit v1.2.3