summaryrefslogtreecommitdiff
path: root/lib/maths.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-03-21 20:23:44 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-03-21 20:23:44 +0000
commit4571ce1b4cac2ab9bf2454ed06d0d787604d62fa (patch)
tree5120afcca84de35d0097cecae62d0b211518ed60 /lib/maths.cpp
parentMake arc_length a member function (diff)
downloadilt-4571ce1b4cac2ab9bf2454ed06d0d787604d62fa.tar.bz2
ilt-4571ce1b4cac2ab9bf2454ed06d0d787604d62fa.tar.xz
ilt-4571ce1b4cac2ab9bf2454ed06d0d787604d62fa.zip
Add helper constructors to Arc
* Two angles, wraps logic ensuring b after a * Two vector directions * Centre and two endpoints, in at least 2 dimensions, uses .xy()
Diffstat (limited to 'lib/maths.cpp')
-rw-r--r--lib/maths.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/maths.cpp b/lib/maths.cpp
index bf17204..51e27fe 100644
--- a/lib/maths.cpp
+++ b/lib/maths.cpp
@@ -4,6 +4,11 @@
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/transform.hpp>
+Arc::Arc(const RelativePosition2D & dir0, const RelativePosition2D & dir1) :
+ Arc {vector_yaw(dir0), vector_yaw(dir1)} { }
+
+Arc::Arc(const Angle anga, const Angle angb) : pair {anga, (angb < anga) ? angb + two_pi : angb} { }
+
glm::mat4
flat_orientation(const Direction3D & diff)
{