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 233 of file Vector.h.

Constructor & Destructor Documentation

◆ Vector4() [1/3]

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

Definition at line 236 of file Vector.h.

236{}

◆ Vector4() [2/3]

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

Definition at line 238 of file Vector.h.

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

◆ Vector4() [3/3]

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

Definition at line 240 of file Vector.h.

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

◆ ~Vector4()

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

Definition at line 242 of file Vector.h.

242{}

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 274 of file Vector.h.

274 {
275 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));
276 }

◆ Dot()

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

Definition at line 252 of file Vector.h.

252 {
253 return x * v.x + y * v.y + z * v.z + w * v.w;
254 }

◆ 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 267 of file Vector.h.

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

◆ Lerp() [2/2]

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

Definition at line 260 of file Vector.h.

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

◆ operator*()

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

Definition at line 282 of file Vector.h.

282 {
283 return Vector4(x * s, y * s, z * s, w * s);
284 }

◆ operator+()

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

Definition at line 278 of file Vector.h.

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

◆ operator-()

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

Definition at line 256 of file Vector.h.

256 {
257 return Vector4(-x, -y, -z, -w);
258 }

◆ Pointer()

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

Definition at line 286 of file Vector.h.

286 {
287 return &x;
288 }

◆ Set()

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

Definition at line 244 of file Vector.h.

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

Member Data Documentation

◆ w

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

Definition at line 293 of file Vector.h.

◆ x

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

Definition at line 290 of file Vector.h.

◆ y

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

Definition at line 291 of file Vector.h.

◆ z

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

Definition at line 292 of file Vector.h.


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