Fovia's C++ Client/Server API
Public Member Functions | Public Attributes | List of all members
VECTOR2F Struct Reference

Public Member Functions

VECTOR2F add (const VECTOR2F &var)
 
void assign (const VECTOR2F &copy)
 
float length ()
 
VECTOR2F mul (const VECTOR2F &var)
 
void normalize ()
 
VECTOR2F operator* (const float &var)
 
VECTOR2F operator* (const VECTOR2F &var)
 
VECTOR2F operator+ (const VECTOR2F &var)
 
VECTOR2Foperator+= (const VECTOR2F &r)
 
VECTOR2F operator- (const VECTOR2F &var)
 
VECTOR2Foperator= (const VECTOR2F &r)
 
bool operator== (VECTOR2F v)
 
VECTOR2F scale (const float scalar)
 
VECTOR2F sub (const VECTOR2F &var)
 
 VECTOR2F ()
 
 VECTOR2F (const VECTOR2F &copy)
 
 VECTOR2F (float nx, float ny)
 

Public Attributes

float x
 
float y
 

Detailed Description

Single precision 2F vector class.

$ \left|x y\right| $

Constructor & Destructor Documentation

VECTOR2F::VECTOR2F ( )
inline

Constructs a new VECTOR2F object. The member fields are not initialized by this function.

VECTOR2F::VECTOR2F ( const VECTOR2F copy)
inline

Copies the contents of copy into this vector.

Parameters
copythe vector from which to copy values into this vector.

References assign().

VECTOR2F::VECTOR2F ( float  nx,
float  ny 
)
inline

Constructs a vector with the values nx, ny and nz.

Parameters
nxThe x value to apply to this vector.
nyThe y value to apply to this vector.

References x, and y.

Member Function Documentation

VECTOR2F VECTOR2F::add ( const VECTOR2F var)
inline

Returns the result of adding the vector var to this vector.

Parameters
varThe right side of the vector add operation.
Returns
The result of the vector add operation.

References x, and y.

void VECTOR2F::assign ( const VECTOR2F copy)
inline

Assigns the contents of copy to the member fields in this object.

Parameters
copyThe vector from which to copy values from.

Referenced by VECTOR2F().

float VECTOR2F::length ( )
inline

Returns the length of this vector.

Returns
The length of this vector.

References x, and y.

Referenced by normalize().

VECTOR2F VECTOR2F::mul ( const VECTOR2F var)
inline

Returns the result of multiplying each component of the vector var with the corresponding component from this vector.

Parameters
varThe right side of the vector multiply operation.
Returns
The result of the vector multiply operation.

References x, and y.

void VECTOR2F::normalize ( )
inline

Performs an in-place normalization of this vector. Note that unlike other vector operations, this is a mutable member function rather than one that returns the result. After this function completes, the result of the length() function on this vector should be roughly 1.0.

References length(), x, and y.

VECTOR2F VECTOR2F::scale ( const float  scalar)
inline

Returns the result of scaling each field in this vector by the value scalar.

Parameters
scalarThe value that each member in this vector will be scaled by.
Returns
The result of the scaling operation.

References x, and y.

VECTOR2F VECTOR2F::sub ( const VECTOR2F var)
inline

Returns the result of subtracting the vector var from this vector.

Parameters
varThe right side of the vector subtract operation.
Returns
The result of the vector subtract operation.

References x, and y.

Member Data Documentation

float VECTOR2F::x

The x value.

Referenced by add(), length(), mul(), normalize(), scale(), sub(), and VECTOR2F().

float VECTOR2F::y

The y value.

Referenced by add(), length(), mul(), normalize(), scale(), sub(), and VECTOR2F().