OpenBarnyard
 
Loading...
Searching...
No Matches
TVector4 Class Reference

#include <TVector4.h>

Public Member Functions

constexpr TVector4 ()=default
 
constexpr TVector4 (TFLOAT a_fX, TFLOAT a_fY, TFLOAT a_fZ, TFLOAT a_fW=1.0f)
 
constexpr TVector4 (TFLOAT a_pFloats[4])
 
constexpr TVector4 (const TVector3 &a_rcOther)
 
constexpr TVector4 (const TVector4 &a_rcOther)
 
constexpr void Set (const TVector3 &vec)
 
constexpr void Set (const TVector4 &vec)
 
constexpr void Set (TFLOAT floats[4])
 
constexpr void Set (TFLOAT x, TFLOAT y, TFLOAT z, TFLOAT w)
 
TFLOAT NormaliseMag ()
 
void Normalise ()
 
void Normalise4 ()
 
constexpr TBOOL isNormalised (TFLOAT fVal=0.05f) const
 
void ProjectNormalToPlane (const TVector4 &vec, const TVector4 &vec2)
 
constexpr void Add (const TVector3 &vec)
 
constexpr void Add (const TVector4 &vec)
 
constexpr void Add4 (const TVector4 &vec)
 
constexpr void Add (const TVector4 &a, const TVector4 &b)
 
constexpr void Add4 (const TVector4 &a, const TVector4 &b)
 
constexpr void Substract4 (const TVector4 &vec)
 
constexpr void Substract (const TVector4 &vec)
 
constexpr void Substract (const TVector4 &a, const TVector4 &b)
 
constexpr void Substract4 (const TVector4 &a, const TVector4 &b)
 
constexpr void Divide (const TVector4 &vec)
 
constexpr void Divide (TFLOAT scalar)
 
constexpr void Divide4 (TFLOAT scalar)
 
constexpr void Divide (const TVector4 &vec1, const TVector4 &vec2)
 
constexpr void Divide (const TVector4 &vec, TFLOAT scalar)
 
constexpr void Multiply (const TVector4 &vec)
 
constexpr void Multiply (TFLOAT scalar)
 
constexpr void Multiply (const TVector4 &vec, TFLOAT scalar)
 
constexpr void Multiply4 (const TVector4 &vec)
 
constexpr void Multiply4 (TFLOAT scalar)
 
constexpr void Multiply4 (const TVector4 &vec, TFLOAT scalar)
 
void Cos (const TVector4 &vec)
 
void CrossProduct (const TVector4 &vec1, const TVector4 &vec2)
 
constexpr void Lerp3 (const TVector4 &finish, TFLOAT t)
 
constexpr void Lerp3 (const TVector4 &start, const TVector4 &finish, TFLOAT t)
 
constexpr void Lerp4 (const TVector4 &finish, TFLOAT t)
 
constexpr void Lerp4 (const TVector4 &start, const TVector4 &finish, TFLOAT t)
 
constexpr double GetScalarProjectionOnUnit (const TVector4 &vec)
 
void Abs (const TVector4 &vec4)
 
void Abs ()
 
constexpr void Negate (const TVector4 &vec)
 
constexpr void Negate ()
 
constexpr void Negate3 (const TVector4 &vec)
 
constexpr void Negate3 ()
 
constexpr void Negate4 (const TVector4 &vec)
 
constexpr void Negate4 ()
 
TFLOAT Magnitude () const
 
TFLOAT Magnitude4 () const
 
constexpr TFLOAT MagnitudeSq () const
 
constexpr TFLOAT MagnitudeSq4 () const
 
TFLOAT MagnitudeXZ () const
 
constexpr TFLOAT MagnitudeSqXZ () const
 
constexpr TBOOL IsEqual (const TVector4 &a_rcVec) const
 
constexpr TVector4 operator+ (const TVector3 &other) const
 
constexpr TVector4 operator- (const TVector3 &other) const
 
constexpr TVector4 operator* (const TVector3 &other) const
 
constexpr TVector4 operator/ (const TVector3 &other) const
 
constexpr TVector4 operator+ (const TVector4 &other) const
 
constexpr TVector4 operator- (const TVector4 &other) const
 
constexpr TVector4 operator* (const TVector4 &other) const
 
constexpr TVector4 operator/ (const TVector4 &other) const
 
void operator= (const TVector3 &other)
 
void operator= (const TVector4 &other)
 
void operator+= (const TVector4 &other)
 
TVector4operator-= (const TVector4 &other)
 
void operator/= (const TVector4 &other)
 
void operator*= (const TVector4 &other)
 
void operator/= (TFLOAT a_fScalar)
 
void operator*= (TFLOAT a_fScalar)
 
TFLOATAsArray ()
 
const TFLOATAsArray () const
 
TVector3AsVector3 ()
 
const TVector3AsVector3 () const
 
TVector2AsVector2 ()
 
const TVector2AsVector2 () const
 
TFLOAT constexpr DotProduct (const TVector4 &vec) const
 
TFLOAT constexpr DotProduct3 (const TVector4 &vec) const
 
TFLOAT constexpr DotProduct4 (const TVector4 &vec) const
 

Static Public Member Functions

static TFLOAT Distance (const TVector4 &vec1, const TVector4 &vec2)
 
static constexpr TFLOAT DistanceSq (const TVector4 &vec1, const TVector4 &vec2)
 
static TFLOAT DistanceXZ (const TVector4 &vec1, const TVector4 &vec2)
 
static constexpr TFLOAT DistanceSqXZ (const TVector4 &vec1, const TVector4 &vec2)
 
static constexpr TFLOAT DotProduct (const TVector4 &vec1, const TVector4 &vec2)
 
static constexpr TFLOAT DotProduct3 (const TVector4 &vec1, const TVector4 &vec2)
 
static constexpr TFLOAT DotProduct4 (const TVector4 &vec1, const TVector4 &vec2)
 
static void Swap (TVector4 &a_rVec1, TVector4 &a_rVec2)
 

Public Attributes

TFLOAT x
 
TFLOAT y
 
TFLOAT z
 
TFLOAT w
 

Static Public Attributes

static const constinit TVector4 VEC_ZERO = TVector4( 0, 0, 0, 1 )
 
static const constinit TVector4 VEC_POSX = TVector4( 1, 0, 0, 1 )
 
static const constinit TVector4 VEC_POSY = TVector4( 0, 1, 0, 1 )
 
static const constinit TVector4 VEC_POSZ = TVector4( 0, 0, 1, 1 )
 
static const constinit TVector4 VEC_NEGX = TVector4( -1, 0, 0, 1 )
 
static const constinit TVector4 VEC_NEGY = TVector4( 0, -1, 0, 1 )
 
static const constinit TVector4 VEC_NEGZ = TVector4( 0, 0, -1, 1 )
 

Detailed Description

Definition at line 7 of file TVector4.h.

Constructor & Destructor Documentation

◆ TVector4() [1/5]

TVector4::TVector4 ( )
constexprdefault

◆ TVector4() [2/5]

TVector4::TVector4 ( TFLOAT a_fX,
TFLOAT a_fY,
TFLOAT a_fZ,
TFLOAT a_fW = 1.0f )
inlineconstexpr

Definition at line 11 of file TVector4.h.

12 : x( a_fX ), y( a_fY ), z( a_fZ ), w( a_fW )
13 {}
TFLOAT w
Definition TVector4.h:367
TFLOAT x
Definition TVector4.h:367
TFLOAT y
Definition TVector4.h:367
TFLOAT z
Definition TVector4.h:367

◆ TVector4() [3/5]

TVector4::TVector4 ( TFLOAT a_pFloats[4])
inlineconstexpr

Definition at line 15 of file TVector4.h.

16 : x( a_pFloats[ 0 ] ), y( a_pFloats[ 1 ] ), z( a_pFloats[ 2 ] ), w( a_pFloats[ 3 ] )
17 {}

◆ TVector4() [4/5]

TVector4::TVector4 ( const TVector3 & a_rcOther)
inlineconstexpr

Definition at line 19 of file TVector4.h.

20 : x( a_rcOther.x ), y( a_rcOther.y ), z( a_rcOther.z ), w( 1.0f )
21 {}
TFLOAT y
Definition TVector3.h:163
TFLOAT z
Definition TVector3.h:163
TFLOAT x
Definition TVector3.h:163

◆ TVector4() [5/5]

TVector4::TVector4 ( const TVector4 & a_rcOther)
inlineconstexpr

Definition at line 23 of file TVector4.h.

24 : x( a_rcOther.x ), y( a_rcOther.y ), z( a_rcOther.z ), w( a_rcOther.w )
25 {}

Member Function Documentation

◆ Abs() [1/2]

void TVector4::Abs ( )
inline

Definition at line 259 of file TVector4.h.

259{ Set( TMath::Abs( x ), TMath::Abs( y ), TMath::Abs( z ), w ); }
TFORCEINLINE TFLOAT Abs(TFLOAT fVal)
Definition TMathInline.h:63
constexpr void Set(const TVector3 &vec)
Definition TVector4.h:27

◆ Abs() [2/2]

void TVector4::Abs ( const TVector4 & vec4)
inline

Definition at line 258 of file TVector4.h.

258{ Set( TMath::Abs( vec4.x ), TMath::Abs( vec4.y ), TMath::Abs( vec4.z ), w ); }

◆ Add() [1/3]

void TVector4::Add ( const TVector3 & vec)
inlineconstexpr

Definition at line 67 of file TVector4.h.

68 {
69 x += vec.x;
70 y += vec.y;
71 z += vec.z;
72 }

◆ Add() [2/3]

void TVector4::Add ( const TVector4 & a,
const TVector4 & b )
inlineconstexpr

Definition at line 90 of file TVector4.h.

91 {
92 Set( a + b );
93 w = a.w;
94 }

◆ Add() [3/3]

void TVector4::Add ( const TVector4 & vec)
inlineconstexpr

Definition at line 74 of file TVector4.h.

75 {
76 x += vec.x;
77 y += vec.y;
78 z += vec.z;
79 }

◆ Add4() [1/2]

void TVector4::Add4 ( const TVector4 & a,
const TVector4 & b )
inlineconstexpr

Definition at line 96 of file TVector4.h.

97 {
98 Set( a );
99 Add4( b );
100 }
constexpr void Add4(const TVector4 &vec)
Definition TVector4.h:81

◆ Add4() [2/2]

void TVector4::Add4 ( const TVector4 & vec)
inlineconstexpr

Definition at line 81 of file TVector4.h.

82 {
83 x += vec.x;
84 y += vec.y;
85 z += vec.z;
86 w += vec.w;
87 }

◆ AsArray() [1/2]

TFLOAT * TVector4::AsArray ( )
inline

Definition at line 318 of file TVector4.h.

318{ return TREINTERPRETCAST( TFLOAT*, this ); }
#define TREINTERPRETCAST(TYPE, VALUE)
Definition Defines.h:68
float TFLOAT
Definition Typedefs.h:4

◆ AsArray() [2/2]

const TFLOAT * TVector4::AsArray ( ) const
inline

Definition at line 319 of file TVector4.h.

319{ return TREINTERPRETCAST( const TFLOAT*, this ); }

◆ AsVector2() [1/2]

TVector2 & TVector4::AsVector2 ( )
inline

Definition at line 324 of file TVector4.h.

324{ return TREINTERPRETCAST( TVector2&, *this ); }

◆ AsVector2() [2/2]

const TVector2 & TVector4::AsVector2 ( ) const
inline

Definition at line 325 of file TVector4.h.

325{ return TREINTERPRETCAST( const TVector2&, *this ); }

◆ AsVector3() [1/2]

TVector3 & TVector4::AsVector3 ( )
inline

Definition at line 321 of file TVector4.h.

321{ return TREINTERPRETCAST( TVector3&, *this ); }

◆ AsVector3() [2/2]

const TVector3 & TVector4::AsVector3 ( ) const
inline

Definition at line 322 of file TVector4.h.

322{ return TREINTERPRETCAST( const TVector3&, *this ); }

◆ Cos()

void TVector4::Cos ( const TVector4 & vec)
inline

Definition at line 214 of file TVector4.h.

215 {
216 x = TMath::Cos( vec.x );
217 y = TMath::Cos( vec.y );
218 z = TMath::Cos( vec.z );
219 w = TMath::Cos( vec.w );
220 }
TFORCEINLINE TFLOAT Cos(TFLOAT fVal)
Definition TMathInline.h:43

◆ CrossProduct()

void TVector4::CrossProduct ( const TVector4 & vec1,
const TVector4 & vec2 )
inline

Definition at line 223 of file TVector4.h.

224 {
225 x = vec2.z * vec1.y - vec2.y * vec1.z;
226 y = vec1.z * vec2.x - vec2.z * vec1.x;
227 z = vec1.x * vec2.y - vec1.y * vec2.x;
228 w = vec1.w;
229 }

◆ Distance()

static TFLOAT TVector4::Distance ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestatic

Definition at line 328 of file TVector4.h.

328{ return ( vec2 - vec1 ).Magnitude(); }

◆ DistanceSq()

static constexpr TFLOAT TVector4::DistanceSq ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestaticconstexpr

Definition at line 331 of file TVector4.h.

331{ return ( vec2 - vec1 ).MagnitudeSq(); }

◆ DistanceSqXZ()

static constexpr TFLOAT TVector4::DistanceSqXZ ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestaticconstexpr

Definition at line 334 of file TVector4.h.

334{ return ( vec2 - vec1 ).MagnitudeSqXZ(); }

◆ DistanceXZ()

static TFLOAT TVector4::DistanceXZ ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestatic

Definition at line 333 of file TVector4.h.

333{ return ( vec2 - vec1 ).MagnitudeXZ(); }

◆ Divide() [1/4]

void TVector4::Divide ( const TVector4 & vec)
inlineconstexpr

Definition at line 130 of file TVector4.h.

131 {
132 x /= vec.x;
133 y /= vec.y;
134 z /= vec.z;
135 }

◆ Divide() [2/4]

void TVector4::Divide ( const TVector4 & vec,
TFLOAT scalar )
inlineconstexpr

Definition at line 163 of file TVector4.h.

164 {
165 Set( vec );
166 Divide( scalar );
167 }
constexpr void Divide(const TVector4 &vec)
Definition TVector4.h:130

◆ Divide() [3/4]

void TVector4::Divide ( const TVector4 & vec1,
const TVector4 & vec2 )
inlineconstexpr

Definition at line 158 of file TVector4.h.

159 {
160 Set( vec1 / vec2 );
161 }

◆ Divide() [4/4]

void TVector4::Divide ( TFLOAT scalar)
inlineconstexpr

Definition at line 137 of file TVector4.h.

138 {
139 TFLOAT ratio = 1.0f / scalar;
140 x *= ratio;
141 y *= ratio;
142 z *= ratio;
143 }

◆ Divide4()

void TVector4::Divide4 ( TFLOAT scalar)
inlineconstexpr

Definition at line 146 of file TVector4.h.

147 {
148 if ( scalar != 0.0f )
149 {
150 TFLOAT ratio = 1.0f / scalar;
151 x *= ratio;
152 y *= ratio;
153 z *= ratio;
154 w *= ratio;
155 }
156 }

◆ DotProduct() [1/2]

TFLOAT constexpr TVector4::DotProduct ( const TVector4 & vec) const
inlineconstexpr

Definition at line 336 of file TVector4.h.

336{ return DotProduct3( *this, vec ); }
TFLOAT constexpr DotProduct3(const TVector4 &vec) const
Definition TVector4.h:339

◆ DotProduct() [2/2]

static constexpr TFLOAT TVector4::DotProduct ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestaticconstexpr

Definition at line 337 of file TVector4.h.

337{ return DotProduct3( vec1, vec2 ); }

◆ DotProduct3() [1/2]

TFLOAT constexpr TVector4::DotProduct3 ( const TVector4 & vec) const
inlineconstexpr

Definition at line 339 of file TVector4.h.

339{ return DotProduct3( *this, vec ); }

◆ DotProduct3() [2/2]

static constexpr TFLOAT TVector4::DotProduct3 ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestaticconstexpr

Definition at line 342 of file TVector4.h.

342{ return vec1.x * vec2.x + vec1.y * vec2.y + vec1.z * vec2.z; }

◆ DotProduct4() [1/2]

TFLOAT constexpr TVector4::DotProduct4 ( const TVector4 & vec) const
inlineconstexpr

Definition at line 344 of file TVector4.h.

344{ return DotProduct4( *this, vec ); }
TFLOAT constexpr DotProduct4(const TVector4 &vec) const
Definition TVector4.h:344

◆ DotProduct4() [2/2]

static constexpr TFLOAT TVector4::DotProduct4 ( const TVector4 & vec1,
const TVector4 & vec2 )
inlinestaticconstexpr

Definition at line 347 of file TVector4.h.

347{ return vec1.x * vec2.x + vec1.y * vec2.y + vec1.z * vec2.z + vec1.w * vec2.w; }

◆ GetScalarProjectionOnUnit()

double TVector4::GetScalarProjectionOnUnit ( const TVector4 & vec)
inlineconstexpr

Definition at line 253 of file TVector4.h.

254 {
255 return (double)( TVector4::z * vec.z + TVector4::x * vec.x + TVector4::y * vec.y );
256 }

◆ IsEqual()

TBOOL TVector4::IsEqual ( const TVector4 & a_rcVec) const
inlineconstexpr

Definition at line 285 of file TVector4.h.

286 {
287 return a_rcVec.x == x && a_rcVec.y == y && a_rcVec.z == z;
288 }

◆ isNormalised()

TBOOL TVector4::isNormalised ( TFLOAT fVal = 0.05f) const
inlineconstexpr

Definition at line 63 of file TVector4.h.

63{ return ( ( ( 1.0f - fVal ) * ( 1.0f - fVal ) ) < MagnitudeSq() ) && ( ( ( 1.0f + fVal ) * ( 1.0f + fVal ) ) >= MagnitudeSq() ); }
constexpr TFLOAT MagnitudeSq() const
Definition TVector4.h:279

◆ Lerp3() [1/2]

void TVector4::Lerp3 ( const TVector4 & finish,
TFLOAT t )
inlineconstexpr

Definition at line 231 of file TVector4.h.

231{ Lerp3( *this, finish, t ); }
constexpr void Lerp3(const TVector4 &finish, TFLOAT t)
Definition TVector4.h:231

◆ Lerp3() [2/2]

void TVector4::Lerp3 ( const TVector4 & start,
const TVector4 & finish,
TFLOAT t )
inlineconstexpr

Definition at line 234 of file TVector4.h.

235 {
236 TVector4::x = ( finish.x - start.x ) * t + start.x;
237 TVector4::y = ( finish.y - start.y ) * t + start.y;
238 TVector4::z = ( finish.z - start.z ) * t + start.z;
239 TVector4::w = start.w;
240 }

◆ Lerp4() [1/2]

void TVector4::Lerp4 ( const TVector4 & finish,
TFLOAT t )
inlineconstexpr

Definition at line 242 of file TVector4.h.

242{ Lerp4( *this, finish, t ); }
constexpr void Lerp4(const TVector4 &finish, TFLOAT t)
Definition TVector4.h:242

◆ Lerp4() [2/2]

void TVector4::Lerp4 ( const TVector4 & start,
const TVector4 & finish,
TFLOAT t )
inlineconstexpr

Definition at line 245 of file TVector4.h.

246 {
247 TVector4::x = ( finish.x - start.x ) * t + start.x;
248 TVector4::y = ( finish.y - start.y ) * t + start.y;
249 TVector4::z = ( finish.z - start.z ) * t + start.z;
250 TVector4::w = ( finish.w - start.w ) * t + start.w;
251 }

◆ Magnitude()

TFLOAT TVector4::Magnitude ( ) const
inline

Definition at line 277 of file TVector4.h.

277{ return TMath::Sqrt( x * x + y * y + z * z ); }
TFORCEINLINE TFLOAT Sqrt(TFLOAT a_fX)
Definition TMathInline.h:84

◆ Magnitude4()

TFLOAT TVector4::Magnitude4 ( ) const
inline

Definition at line 278 of file TVector4.h.

278{ return TMath::Sqrt( w * w + x * x + y * y + z * z ); }

◆ MagnitudeSq()

TFLOAT TVector4::MagnitudeSq ( ) const
inlineconstexpr

Definition at line 279 of file TVector4.h.

279{ return x * x + y * y + z * z; }

◆ MagnitudeSq4()

TFLOAT TVector4::MagnitudeSq4 ( ) const
inlineconstexpr

Definition at line 280 of file TVector4.h.

280{ return w * w + x * x + y * y + z * z; }

◆ MagnitudeSqXZ()

TFLOAT TVector4::MagnitudeSqXZ ( ) const
inlineconstexpr

Definition at line 282 of file TVector4.h.

282{ return x * x + z * z; }

◆ MagnitudeXZ()

TFLOAT TVector4::MagnitudeXZ ( ) const
inline

Definition at line 281 of file TVector4.h.

281{ return TMath::Sqrt( x * x + z * z ); }

◆ Multiply() [1/3]

void TVector4::Multiply ( const TVector4 & vec)
inlineconstexpr

Definition at line 170 of file TVector4.h.

171 {
172 x *= vec.x;
173 y *= vec.y;
174 z *= vec.z;
175 }

◆ Multiply() [2/3]

void TVector4::Multiply ( const TVector4 & vec,
TFLOAT scalar )
inlineconstexpr

Definition at line 186 of file TVector4.h.

187 {
188 Set( vec );
189 Multiply( scalar );
190 }
constexpr void Multiply(const TVector4 &vec)
Definition TVector4.h:170

◆ Multiply() [3/3]

void TVector4::Multiply ( TFLOAT scalar)
inlineconstexpr

Definition at line 178 of file TVector4.h.

179 {
180 x *= scalar;
181 y *= scalar;
182 z *= scalar;
183 }

◆ Multiply4() [1/3]

void TVector4::Multiply4 ( const TVector4 & vec)
inlineconstexpr

Definition at line 192 of file TVector4.h.

193 {
194 x *= vec.x;
195 y *= vec.y;
196 z *= vec.z;
197 w *= vec.w;
198 }

◆ Multiply4() [2/3]

void TVector4::Multiply4 ( const TVector4 & vec,
TFLOAT scalar )
inlineconstexpr

Definition at line 208 of file TVector4.h.

209 {
210 Set( vec );
211 Multiply4( scalar );
212 }
constexpr void Multiply4(const TVector4 &vec)
Definition TVector4.h:192

◆ Multiply4() [3/3]

void TVector4::Multiply4 ( TFLOAT scalar)
inlineconstexpr

Definition at line 200 of file TVector4.h.

201 {
202 x *= scalar;
203 y *= scalar;
204 z *= scalar;
205 w *= scalar;
206 }

◆ Negate() [1/2]

void TVector4::Negate ( )
inlineconstexpr

Definition at line 262 of file TVector4.h.

262{ Negate3(); }
constexpr void Negate3()
Definition TVector4.h:267

◆ Negate() [2/2]

void TVector4::Negate ( const TVector4 & vec)
inlineconstexpr

Definition at line 261 of file TVector4.h.

261{ Negate3( vec ); }

◆ Negate3() [1/2]

void TVector4::Negate3 ( )
inlineconstexpr

Definition at line 267 of file TVector4.h.

268 {
269 x = -x;
270 y = -y;
271 z = -z;
272 }

◆ Negate3() [2/2]

void TVector4::Negate3 ( const TVector4 & vec)
inlineconstexpr

Definition at line 265 of file TVector4.h.

265{ Set( -vec.x, -vec.y, -vec.z, vec.w ); }

◆ Negate4() [1/2]

void TVector4::Negate4 ( )
inlineconstexpr

Definition at line 275 of file TVector4.h.

275{ Set( -x, -y, -z, -w ); }

◆ Negate4() [2/2]

void TVector4::Negate4 ( const TVector4 & vec)
inlineconstexpr

Definition at line 274 of file TVector4.h.

274{ Set( -vec.x, -vec.y, -vec.z, -vec.w ); }

◆ Normalise()

void TVector4::Normalise ( )

Definition at line 36 of file TVector4.cpp.

37{
38 TFLOAT fMagnitudeSq = MagnitudeSq();
39
40 if ( fMagnitudeSq != 0.0f )
41 {
42 TFLOAT fMultiplier = TMath::OneOverSqrt( fMagnitudeSq );
43 x *= fMultiplier;
44 y *= fMultiplier;
45 z *= fMultiplier;
46 return;
47 }
48
49 x = 0.0f;
50 y = 0.0f;
51 z = 1.0f;
52}
TFORCEINLINE TFLOAT OneOverSqrt(TFLOAT a_fX)
Definition TMathInline.h:92

◆ Normalise4()

void TVector4::Normalise4 ( )

Definition at line 64 of file TVector4.cpp.

65{
67}
constexpr void Divide4(TFLOAT scalar)
Definition TVector4.h:146
TFLOAT Magnitude4() const
Definition TVector4.h:278

◆ NormaliseMag()

TFLOAT TVector4::NormaliseMag ( )

Definition at line 15 of file TVector4.cpp.

16{
17 TFLOAT fMagnitudeSq = MagnitudeSq();
18
19 if ( fMagnitudeSq != 0.0f )
20 {
21 TFLOAT fMultiplier = TMath::OneOverSqrt( fMagnitudeSq );
22 x *= fMultiplier;
23 y *= fMultiplier;
24 z *= fMultiplier;
25
26 return 1.0f / fMultiplier;
27 }
28
29 x = 0.0f;
30 y = 0.0f;
31 z = 1.0f;
32 return fMagnitudeSq;
33}

◆ operator*() [1/2]

TVector4 TVector4::operator* ( const TVector3 & other) const
inlineconstexpr

Definition at line 292 of file TVector4.h.

292{ return { x * other.x, y * other.y, z * other.z, w }; }

◆ operator*() [2/2]

TVector4 TVector4::operator* ( const TVector4 & other) const
inlineconstexpr

Definition at line 299 of file TVector4.h.

299{ return { x * other.x, y * other.y, z * other.z, other.w }; }

◆ operator*=() [1/2]

void TVector4::operator*= ( const TVector4 & other)
inline

Definition at line 313 of file TVector4.h.

313{ Multiply( other ); }

◆ operator*=() [2/2]

void TVector4::operator*= ( TFLOAT a_fScalar)
inline

Definition at line 316 of file TVector4.h.

316{ Multiply( a_fScalar ); }

◆ operator+() [1/2]

TVector4 TVector4::operator+ ( const TVector3 & other) const
inlineconstexpr

Definition at line 290 of file TVector4.h.

290{ return { x + other.x, y + other.y, z + other.z, w }; }

◆ operator+() [2/2]

TVector4 TVector4::operator+ ( const TVector4 & other) const
inlineconstexpr

Definition at line 295 of file TVector4.h.

295{ return { x + other.x, y + other.y, z + other.z, other.w }; }

◆ operator+=()

void TVector4::operator+= ( const TVector4 & other)
inline

Definition at line 304 of file TVector4.h.

304{ Add( other ); }
constexpr void Add(const TVector3 &vec)
Definition TVector4.h:67

◆ operator-() [1/2]

TVector4 TVector4::operator- ( const TVector3 & other) const
inlineconstexpr

Definition at line 291 of file TVector4.h.

291{ return { x - other.x, y - other.y, z - other.z, w }; }

◆ operator-() [2/2]

TVector4 TVector4::operator- ( const TVector4 & other) const
inlineconstexpr

Definition at line 296 of file TVector4.h.

296{ return { x - other.x, y - other.y, z - other.z, other.w }; }

◆ operator-=()

TVector4 & TVector4::operator-= ( const TVector4 & other)
inline

Definition at line 306 of file TVector4.h.

307 {
308 Substract( other );
309 return *this;
310 }
constexpr void Substract(const TVector4 &vec)
Definition TVector4.h:110

◆ operator/() [1/2]

TVector4 TVector4::operator/ ( const TVector3 & other) const
inlineconstexpr

Definition at line 293 of file TVector4.h.

293{ return { x / other.x, y / other.y, z / other.z, w }; }

◆ operator/() [2/2]

TVector4 TVector4::operator/ ( const TVector4 & other) const
inlineconstexpr

Definition at line 300 of file TVector4.h.

300{ return { x / other.x, y / other.y, z / other.z, other.w }; }

◆ operator/=() [1/2]

void TVector4::operator/= ( const TVector4 & other)
inline

Definition at line 312 of file TVector4.h.

312{ Divide( other ); }

◆ operator/=() [2/2]

void TVector4::operator/= ( TFLOAT a_fScalar)
inline

Definition at line 315 of file TVector4.h.

315{ Divide( a_fScalar ); }

◆ operator=() [1/2]

void TVector4::operator= ( const TVector3 & other)
inline

Definition at line 302 of file TVector4.h.

302{ Set( other ); }

◆ operator=() [2/2]

void TVector4::operator= ( const TVector4 & other)
inline

Definition at line 303 of file TVector4.h.

303{ Set( other ); }

◆ ProjectNormalToPlane()

void TVector4::ProjectNormalToPlane ( const TVector4 & vec,
const TVector4 & vec2 )

Definition at line 55 of file TVector4.cpp.

56{
57 TVector4 crossProduct;
58 crossProduct.CrossProduct( vec2, vec );
59 CrossProduct( crossProduct, vec2 );
60 Normalise();
61}
constexpr TVector4()=default
void CrossProduct(const TVector4 &vec1, const TVector4 &vec2)
Definition TVector4.h:223
void Normalise()
Definition TVector4.cpp:36

◆ Set() [1/4]

void TVector4::Set ( const TVector3 & vec)
inlineconstexpr

Definition at line 27 of file TVector4.h.

28 {
29 TVector4::x = vec.x;
30 TVector4::y = vec.y;
31 TVector4::z = vec.z;
32 TVector4::w = 1.0f;
33 }

◆ Set() [2/4]

void TVector4::Set ( const TVector4 & vec)
inlineconstexpr

Definition at line 36 of file TVector4.h.

37 {
38 TVector4::x = vec.x;
39 TVector4::y = vec.y;
40 TVector4::z = vec.z;
41 TVector4::w = vec.w;
42 }

◆ Set() [3/4]

void TVector4::Set ( TFLOAT floats[4])
inlineconstexpr

Definition at line 44 of file TVector4.h.

45 {
46 TVector4::x = floats[ 0 ];
47 TVector4::y = floats[ 1 ];
48 TVector4::z = floats[ 2 ];
49 TVector4::w = floats[ 3 ];
50 }

◆ Set() [4/4]

void TVector4::Set ( TFLOAT x,
TFLOAT y,
TFLOAT z,
TFLOAT w )
inlineconstexpr

Definition at line 52 of file TVector4.h.

53 {
54 TVector4::x = x;
55 TVector4::y = y;
56 TVector4::z = z;
57 TVector4::w = w;
58 }

◆ Substract() [1/2]

void TVector4::Substract ( const TVector4 & a,
const TVector4 & b )
inlineconstexpr

Definition at line 118 of file TVector4.h.

119 {
120 Set( a - b );
121 w = a.w;
122 }

◆ Substract() [2/2]

void TVector4::Substract ( const TVector4 & vec)
inlineconstexpr

Definition at line 110 of file TVector4.h.

111 {
112 x -= vec.x;
113 y -= vec.y;
114 z -= vec.z;
115 }

◆ Substract4() [1/2]

void TVector4::Substract4 ( const TVector4 & a,
const TVector4 & b )
inlineconstexpr

Definition at line 124 of file TVector4.h.

125 {
126 Set( a );
127 Substract4( b );
128 }
constexpr void Substract4(const TVector4 &vec)
Definition TVector4.h:102

◆ Substract4() [2/2]

void TVector4::Substract4 ( const TVector4 & vec)
inlineconstexpr

Definition at line 102 of file TVector4.h.

103 {
104 x -= vec.x;
105 y -= vec.y;
106 z -= vec.z;
107 w -= vec.w;
108 }

◆ Swap()

static void TVector4::Swap ( TVector4 & a_rVec1,
TVector4 & a_rVec2 )
inlinestatic

Definition at line 350 of file TVector4.h.

351 {
352 TVector4 temp = a_rVec1;
353 a_rVec1 = a_rVec2;
354 a_rVec2 = temp;
355 }

Member Data Documentation

◆ VEC_NEGX

const TVector4 TVector4::VEC_NEGX = TVector4( -1, 0, 0, 1 )
staticconstinit

Definition at line 362 of file TVector4.h.

◆ VEC_NEGY

const TVector4 TVector4::VEC_NEGY = TVector4( 0, -1, 0, 1 )
staticconstinit

Definition at line 363 of file TVector4.h.

◆ VEC_NEGZ

const TVector4 TVector4::VEC_NEGZ = TVector4( 0, 0, -1, 1 )
staticconstinit

Definition at line 364 of file TVector4.h.

◆ VEC_POSX

const TVector4 TVector4::VEC_POSX = TVector4( 1, 0, 0, 1 )
staticconstinit

Definition at line 359 of file TVector4.h.

◆ VEC_POSY

const TVector4 TVector4::VEC_POSY = TVector4( 0, 1, 0, 1 )
staticconstinit

Definition at line 360 of file TVector4.h.

◆ VEC_POSZ

const TVector4 TVector4::VEC_POSZ = TVector4( 0, 0, 1, 1 )
staticconstinit

Definition at line 361 of file TVector4.h.

◆ VEC_ZERO

const TVector4 TVector4::VEC_ZERO = TVector4( 0, 0, 0, 1 )
staticconstinit

Definition at line 358 of file TVector4.h.

◆ w

TFLOAT TVector4::w

Definition at line 367 of file TVector4.h.

◆ x

TFLOAT TVector4::x

Definition at line 367 of file TVector4.h.

◆ y

TFLOAT TVector4::y

Definition at line 367 of file TVector4.h.

◆ z

TFLOAT TVector4::z

Definition at line 367 of file TVector4.h.


The documentation for this class was generated from the following files: