From c6c0d8005880d73b8560bcb10c34a6e8b2da703e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Mar 2024 18:04:57 +0000 Subject: Extract vector_normal helper into lib --- lib/maths.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') 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 +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 -- cgit v1.2.3