CSEngine
Loading...
Searching...
No Matches
CSE::Vector4< T > Class Template Reference

Public Member Functions

 Vector4 (T x, T y, T z, T w)
 
 Vector4 (const Vector3< T > &v, T w)
 
void Set (T x, T y, T z, T w)
 
Dot (const Vector4 &v) const
 
Vector4 operator- () const
 
Vector4 Lerp (float t, const Vector4 &v) const
 
Vector4 Lerp (float t, const Vector4 &a, const Vector4 &b) const
 
Vector4 operator+ (const Vector4 &v) const
 
Vector4 operator* (T s) const
 
const T * Pointer () const
 

Static Public Member Functions

static float Distance (const Vector4 &a, const Vector4 &b)
 

Public Attributes

x
 
y
 
z
 
w
 

Detailed Description

template<typename T>
class CSE::Vector4< T >

Definition at line 231 of file Vector.h.

Constructor & Destructor Documentation

◆ Vector4() [1/3]

template<typename T >
CSE::Vector4< T >::Vector4 ( )
inline

Definition at line 234 of file Vector.h.

234{}

◆ Vector4() [2/3]

template<typename T >
CSE::Vector4< T >::Vector4 ( x,
y,
z,
w 
)
inline

Definition at line 236 of file Vector.h.

236: x(x), y(y), z(z), w(w) {}

◆ Vector4() [3/3]

template<typename T >
CSE::Vector4< T >::Vector4 ( const Vector3< T > &  v,
w 
)
inline

Definition at line 238 of file Vector.h.

238: x(v.x), y(v.y), z(v.z), w(w) {}

◆ ~Vector4()

template<typename T >
CSE::Vector4< T >::~Vector4 ( )
inline

Definition at line 240 of file Vector.h.

240{}

Member Function Documentation

◆ Distance()

template<typename T >
static float CSE::Vector4< T >::Distance ( const Vector4< T > &  a,
const Vector4< T > &  b 
)
inlinestatic

Definition at line 272 of file Vector.h.

272 {
273 return sqrtf(powf(a.x - b.x, 2) + powf(a.y - b.y, 2) + powf(a.z - b.z, 2) + powf(a.w - b.w, 2));
274 }

◆ Dot()

template<typename T >
T CSE::Vector4< T >::Dot ( const Vector4< T > &  v) const
inline

Definition at line 250 of file Vector.h.

250 {
251 return x * v.x + y * v.y + z * v.z + w * v.w;
252 }

◆ Lerp() [1/2]

template<typename T >
Vector4 CSE::Vector4< T >::Lerp ( float  t,
const Vector4< T > &  a,
const Vector4< T > &  b 
) const
inline

Definition at line 265 of file Vector.h.

265 {
266 return Vector4(a.x * (1 - t) + b.x * t,
267 a.y * (1 - t) + b.y * t,
268 a.z * (1 - t) + b.z * t,
269 a.w * (1 - t) + b.w * t);
270 }

◆ Lerp() [2/2]

template<typename T >
Vector4 CSE::Vector4< T >::Lerp ( float  t,
const Vector4< T > &  v 
) const
inline

Definition at line 258 of file Vector.h.

258 {
259 return Vector4(x * (1 - t) + v.x * t,
260 y * (1 - t) + v.y * t,
261 z * (1 - t) + v.z * t,
262 w * (1 - t) + v.w * t);
263 }

◆ operator*()

template<typename T >
Vector4 CSE::Vector4< T >::operator* ( s) const
inline

Definition at line 280 of file Vector.h.

280 {
281 return Vector4(x * s, y * s, z * s, w * s);
282 }

◆ operator+()

template<typename T >
Vector4 CSE::Vector4< T >::operator+ ( const Vector4< T > &  v) const
inline

Definition at line 276 of file Vector.h.

276 {
277 return Vector4(x + v.x, y + v.y, z + v.z, w + v.w);
278 }

◆ operator-()

template<typename T >
Vector4 CSE::Vector4< T >::operator- ( ) const
inline

Definition at line 254 of file Vector.h.

254 {
255 return Vector4(-x, -y, -z, -w);
256 }

◆ Pointer()

template<typename T >
const T * CSE::Vector4< T >::Pointer ( ) const
inline

Definition at line 284 of file Vector.h.

284 {
285 return &x;
286 }

◆ Set()

template<typename T >
void CSE::Vector4< T >::Set ( x,
y,
z,
w 
)
inline

Definition at line 242 of file Vector.h.

242 {
243 this->x = x;
244 this->y = y;
245 this->z = z;
246 this->w = w;
247
248 }

Member Data Documentation

◆ w

template<typename T >
T CSE::Vector4< T >::w

Definition at line 291 of file Vector.h.

◆ x

template<typename T >
T CSE::Vector4< T >::x

Definition at line 288 of file Vector.h.

◆ y

template<typename T >
T CSE::Vector4< T >::y

Definition at line 289 of file Vector.h.

◆ z

template<typename T >
T CSE::Vector4< T >::z

Definition at line 290 of file Vector.h.


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