1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Add vector normalization method

This commit is contained in:
unknown 2023-10-03 17:01:33 +03:00
parent 2d3560994f
commit 87b4296e12

View File

@ -129,6 +129,7 @@ public:
} }
vec_t NormalizeInPlace(); vec_t NormalizeInPlace();
Vector Normalized() const;
bool IsLengthGreaterThan( float val ) const; bool IsLengthGreaterThan( float val ) const;
bool IsLengthLessThan( float val ) const; bool IsLengthLessThan( float val ) const;
@ -2220,6 +2221,13 @@ inline vec_t Vector::NormalizeInPlace()
return VectorNormalize( *this ); return VectorNormalize( *this );
} }
inline Vector Vector::Normalized() const
{
Vector norm = *this;
VectorNormalize( norm );
return norm;
}
inline bool Vector::IsLengthGreaterThan( float val ) const inline bool Vector::IsLengthGreaterThan( float val ) const
{ {
return LengthSqr() > val*val; return LengthSqr() > val*val;