From 87b4296e128e11f8468466046115655ac07222fe Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Oct 2023 17:01:33 +0300 Subject: [PATCH] Add vector normalization method --- public/mathlib/vector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/mathlib/vector.h b/public/mathlib/vector.h index edef6df54..9b2e0dbd1 100644 --- a/public/mathlib/vector.h +++ b/public/mathlib/vector.h @@ -129,6 +129,7 @@ class Vector } vec_t NormalizeInPlace(); + Vector Normalized() const; bool IsLengthGreaterThan( float val ) const; bool IsLengthLessThan( float val ) const; @@ -2220,6 +2221,13 @@ inline vec_t Vector::NormalizeInPlace() return VectorNormalize( *this ); } +inline Vector Vector::Normalized() const +{ + Vector norm = *this; + VectorNormalize( norm ); + return norm; +} + inline bool Vector::IsLengthGreaterThan( float val ) const { return LengthSqr() > val*val;