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