diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-23 18:04:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-23 18:04:57 +0000 |
commit | c6c0d8005880d73b8560bcb10c34a6e8b2da703e (patch) | |
tree | 6e33f8f41154c2731435222856378d2c020893a9 /lib | |
parent | Add helper constructors to Arc (diff) | |
download | ilt-c6c0d8005880d73b8560bcb10c34a6e8b2da703e.tar.bz2 ilt-c6c0d8005880d73b8560bcb10c34a6e8b2da703e.tar.xz ilt-c6c0d8005880d73b8560bcb10c34a6e8b2da703e.zip |
Extract vector_normal helper into lib
Diffstat (limited to 'lib')
-rw-r--r-- | lib/maths.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h index 656fefd..63b752a 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -98,6 +98,13 @@ glm::mat4 rotate_ypr(Rotation3D); float vector_yaw(const Direction2D & diff); float vector_pitch(const Direction3D & diff); +template<typename T, glm::qualifier Q> +glm::vec<2, T, Q> +vector_normal(const glm::vec<2, T, Q> & v) +{ + return {-v.y, v.x}; +}; + float round_frac(const float & v, const float & frac); template<typename T> |