Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DVector4n Class Reference

The U4DVector4n class represents a 4D vector in space. Note: This class does not perform any linear algebra operations. It simply serves as a representation and is used as a helper in class. More...

Public Member Functions

 U4DVector4n ()
 Constructor which creates a default 4D vector. That is, it creates a 4D vector with x, y, z and w components equal to zero.
 
 U4DVector4n (float nx, float ny, float nz, float nw)
 Constructor which creates a 4D vector with x, y, z and w components. More...
 
 ~U4DVector4n ()
 Default destructor for a 4D vector.
 
 U4DVector4n (const U4DVector4n &a)
 Copy constructor. More...
 
U4DVector4noperator= (const U4DVector4n &a)
 Copy constructor. More...
 
void operator+= (const U4DVector4n &v)
 Method that calculates the addition of two vectors. More...
 
U4DVector4n operator+ (const U4DVector4n &v) const
 Method that calculates the addition of two vectors. More...
 
void operator*= (const float s)
 Method which multiplies a 4D vector by a scalar. More...
 
U4DVector4n operator* (const float s) const
 Method which multiplies a 4D vector by a scalar. More...
 
float dot (const U4DVector4n &v) const
 Method that calculates the dot product between two 4D vectors. More...
 
void show ()
 Method which prints the components of the 4D vector.
 
float getX ()
 Method to get the x component value of the vector. More...
 
float getY ()
 Method to get the y component value of the vector. More...
 
float getZ ()
 Method to get the z component value of the vector. More...
 
float getW ()
 Method to get the y component value of the vector. More...
 

Public Attributes

float x
 x-component
 
float y
 y-component
 
float z
 z-component
 
float w
 w-component
 

Detailed Description

The U4DVector4n class represents a 4D vector in space. Note: This class does not perform any linear algebra operations. It simply serves as a representation and is used as a helper in class.

Constructor & Destructor Documentation

◆ U4DVector4n() [1/2]

U4DEngine::U4DVector4n::U4DVector4n ( float  nx,
float  ny,
float  nz,
float  nw 
)

Constructor which creates a 4D vector with x, y, z and w components.

Parameters
nxx component
nyy component
nzz component
nww component
Returns
Constructs a vector with the given x,y, z and w components

◆ U4DVector4n() [2/2]

U4DEngine::U4DVector4n::U4DVector4n ( const U4DVector4n a)

Copy constructor.

Parameters
a4D vector to copy
Returns
A copy of the 4D vector

Member Function Documentation

◆ dot()

float U4DEngine::U4DVector4n::dot ( const U4DVector4n v) const

Method that calculates the dot product between two 4D vectors.

Parameters
vA 4D vector to compute the dot product with
Returns
Returns the dot product between two 4D vectors

◆ getW()

float U4DEngine::U4DVector4n::getW ( )

Method to get the y component value of the vector.

Returns
returns the w-component value

◆ getX()

float U4DEngine::U4DVector4n::getX ( )

Method to get the x component value of the vector.

Returns
returns the x-component value

◆ getY()

float U4DEngine::U4DVector4n::getY ( )

Method to get the y component value of the vector.

Returns
returns the y-component value

◆ getZ()

float U4DEngine::U4DVector4n::getZ ( )

Method to get the z component value of the vector.

Returns
returns the z-component value

◆ operator*()

U4DVector4n U4DEngine::U4DVector4n::operator* ( const float  s) const

Method which multiplies a 4D vector by a scalar.

Parameters
sScalar value to multiply
Returns
Returns the multiplication product betweent the 4D vector and scalar

◆ operator*=()

void U4DEngine::U4DVector4n::operator*= ( const float  s)

Method which multiplies a 4D vector by a scalar.

Parameters
sScalar value to multiply
Returns
Returns the multiplication product betweent the 4D vector and scalar

◆ operator+()

U4DVector4n U4DEngine::U4DVector4n::operator+ ( const U4DVector4n v) const

Method that calculates the addition of two vectors.

Parameters
v4D vector to add
Returns
Returns a third vector representing the addition of two 4D vectors

◆ operator+=()

void U4DEngine::U4DVector4n::operator+= ( const U4DVector4n v)

Method that calculates the addition of two vectors.

Parameters
vVector to add.
Returns
Returns the addition of two vectors.

◆ operator=()

U4DVector4n & U4DEngine::U4DVector4n::operator= ( const U4DVector4n a)

Copy constructor.

Parameters
a4D vector to copy
Returns
A copy of the 4D vector