sgVector2 Class Reference

#include <sgVector2.h>

List of all members.

Public Member Functions

 sgVector2 (float x_=0.0f, float y_=0.0f)
 sgVector2 (const sgVector2 &other)
bool operator== (const sgVector2 &other)
bool operator!= (const sgVector2 &other)
sgVector2operator= (const sgVector2 &other)
sgVector2operator= (const float &other)
sgVector2operator+= (const sgVector2 &other)
sgVector2operator-= (const sgVector2 &other)
sgVector2operator*= (const sgVector2 &other)
sgVector2operator/= (const sgVector2 &other)
sgVector2 operator+ (const sgVector2 &other)
sgVector2 operator- (const sgVector2 &other)
sgVector2 operator* (const sgVector2 &other)
sgVector2 operator/ (const sgVector2 &other)
sgVector2operator+= (const float &other)
sgVector2operator-= (const float &other)
sgVector2operator*= (const float &other)
sgVector2operator/= (const float &other)
sgVector2 operator+ (const float &other)
sgVector2 operator- (const float &other)
sgVector2 operator* (const float &other)
sgVector2 operator/ (const float &other)
float length ()
void makeIdentity ()
void normalize ()
float dot (sgVector2 &other)
float dist (sgVector2 &other)

Public Attributes

float x
float y

Detailed Description

2D vector class. Stores a vector with two elements and provides functionality for it.


Constructor & Destructor Documentation

sgVector2::sgVector2 ( float  x_ = 0.0f,
float  y_ = 0.0f 
)

Constructor. Initializes a new instance.

Parameters:
x_ the x value
y_ the y value
sgVector2::sgVector2 ( const sgVector2 other  ) 

Constructor. Initializes a new instance.

Parameters:
other vector to copy the values from

Member Function Documentation

float sgVector2::dist ( sgVector2 other  ) 

Distance. The distance of the vector with the other one.

Parameters:
other another vector
Returns:
the distance of both vectors
float sgVector2::dot ( sgVector2 other  ) 

Dot product. The dot product of the vector with the other one.

Parameters:
other another vector
Returns:
the resulting scalar
float sgVector2::length (  ) 

Length. Get the length of the vector.

Returns:
the vectors length
void sgVector2::makeIdentity (  ) 

Make identity. Sets the vectors components to 0.

void sgVector2::normalize (  ) 

Normalize. Keeps the vectors direction, but sets its length to 1.

bool sgVector2::operator!= ( const sgVector2 other  ) 

Not equal. Checks if two instances do not equal each other.

sgVector2 sgVector2::operator* ( const float &  other  ) 

Multiply. Multiply the scalar to each component of the vector.

sgVector2 sgVector2::operator* ( const sgVector2 other  ) 

Multiply. Multiply the two vectors component wise.

sgVector2 & sgVector2::operator*= ( const float &  other  ) 

Multiply. Multiply the scalar to each component of the vector.

sgVector2 & sgVector2::operator*= ( const sgVector2 other  ) 

Multiply. Multiply the two vectors component wise.

sgVector2 sgVector2::operator+ ( const float &  other  ) 

Add. Add the scalar to each component of the vector.

sgVector2 sgVector2::operator+ ( const sgVector2 other  ) 

Add. Add the two vectors component wise.

sgVector2 & sgVector2::operator+= ( const float &  other  ) 

Add. Add the scalar to each component of the vector.

sgVector2 & sgVector2::operator+= ( const sgVector2 other  ) 

Add. Add the two vectors component wise.

sgVector2 sgVector2::operator- ( const float &  other  ) 

Substract. Substract the scalar from each component of the vector.

sgVector2 sgVector2::operator- ( const sgVector2 other  ) 

Substract. Substract the two vectors component wise.

sgVector2 & sgVector2::operator-= ( const float &  other  ) 

Substract. Substract the scalar from each component of the vector.

sgVector2 & sgVector2::operator-= ( const sgVector2 other  ) 

Substract. Substract the two vectors component wise.

sgVector2 sgVector2::operator/ ( const float &  other  ) 

Divide. Divide each component of the vector by the scalar.

sgVector2 sgVector2::operator/ ( const sgVector2 other  ) 

Divide. Divide the two vectors component wise.

sgVector2 & sgVector2::operator/= ( const float &  other  ) 

Divide. Divide each component of the vector by the scalar.

sgVector2 & sgVector2::operator/= ( const sgVector2 other  ) 

Divide. Divide the two vectors component wise.

sgVector2 & sgVector2::operator= ( const float &  other  ) 

Copy. Sets all components to the value of the scalar.

sgVector2 & sgVector2::operator= ( const sgVector2 other  ) 

Copy. Copy the values of one instance to the other.

bool sgVector2::operator== ( const sgVector2 other  ) 

Equal. Checks if two instances equal each other.


Member Data Documentation

float sgVector2::x

X. The vectors x component.

float sgVector2::y

Y. The vectors y component.


The documentation for this class was generated from the following files:
Generated on Thu Jun 3 13:31:04 2010 for iSDGE by  doxygen 1.6.3