From edfca12b1838ca5459b200882bd32074f66ed6c2 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 10 Mar 2023 17:24:00 -0500 Subject: [PATCH] projection --- include/blt/math/vectors.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index a2fc0c0..7744ab8 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -141,6 +141,12 @@ namespace blt { left.z() * right.x() - left.x() * right.z(), left.x() * right.y() - left.y() * right.x()}; } + + static inline vec project(const vec& u, const vec& v){ + float du = dot(u); + float dv = dot(v); + return (du / dv) * v; + } }; template