summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 12:59:07 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 12:59:07 +0000
commit9506960a925367b3ac45f8bd7775b3a70cb0baec (patch)
tree15c23121a44febc9e27fb64b52bc7467906335cb
parentAdd consts for other compass points (diff)
downloadilt-9506960a925367b3ac45f8bd7775b3a70cb0baec.tar.bz2
ilt-9506960a925367b3ac45f8bd7775b3a70cb0baec.tar.xz
ilt-9506960a925367b3ac45f8bd7775b3a70cb0baec.zip
Add operator[] to Arc
-rw-r--r--utility/maths.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/utility/maths.h b/utility/maths.h
index 22688cb..31f5960 100644
--- a/utility/maths.h
+++ b/utility/maths.h
@@ -5,7 +5,15 @@
#include <glm/gtc/constants.hpp>
#include <utility>
-using Arc = std::pair<float, float>;
+struct Arc : public std::pair<float, float> {
+ using std::pair<float, float>::pair;
+
+ float
+ operator[](unsigned int i) const
+ {
+ return i ? second : first;
+ }
+};
constexpr const glm::vec3 up {0, 1, 0};
constexpr const glm::vec3 north {0, 0, 1};