From 38aad873ff46784a344beca8d1d054a2932779a0 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 20 Feb 2014 23:37:16 -0700 Subject: [PATCH] Adding stubs for TVector3 helper functions. --- include/math/Vector3.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/math/Vector3.h b/include/math/Vector3.h index 4e54233..9b25d17 100644 --- a/include/math/Vector3.h +++ b/include/math/Vector3.h @@ -24,6 +24,8 @@ TVector3( void ); TVector3( BaseType X, BaseType Y, BaseType Z ); + // compare Len, which isn't added yet + //bool operator<( const TVector3& ) const; bool operator==( const TVector3& ) const; bool operator!=( const TVector3& ) const; @@ -44,6 +46,39 @@ // TODO: Add other helper functions + // Can only be used on non-zero vectors. Returns *this so you can chain method calls. + TVector3& Normalize( void ); + TVector3& Clamp( BaseType maxLength ); + TVector3& Clamp( BaseType minLength, BaseType maxLength ); + TVector3& SetLen( BaseType length ); + + BaseType Len( void ); + BaseType LenSqr( void ); + + BaseType Dist( void ); + BaseType DistSqr( void ); + + BaseType Dot( const TVector3& v ); + + BaseType Angle( const TVector3& v ); + BaseType AngleNorm( const TVector3& v ); + + TVector3 Cross( const TVector3& v ); + TVector3 Perpendicular( void ); + TVector3 Project( const TVector3& v ); + TVector3 Reflect( const TVector3& v ); + TVector3 Rotate( BaseType angle, const TVector3& axis ); + + TVector3 Lerp( const TVector3& v, BaseType n ); + TVector3 Slerp( const TVector3& v, BaseType n ); + TVector3 Nlerp( const TVector3& v, BaseType n ); + + // might be confusing as method? At least with function you have parameters to + // tell user what the vector representatio is. + TVector3 ToPolar( void ); + TVector3 ToCartesian( void ); + TVector3 ToEuler( BaseType angle ); + bool IsZero( void ) const;