Gel2D - The free/open source game creation suite

Public Member Functions | Public Attributes
gel::Gel2dVec Class Reference

2D vector class with lots of operators and a few useful functions. More...

#include <gelVector.h>

List of all members.

Public Member Functions

 Gel2dVec ()
 Default constructor.
 Gel2dVec (const Gel2dVec &vec)
 Copy constructor.
 Gel2dVec (float n)
 Single value constructor.
 Gel2dVec (float _x, float _y)
 Gel2dVec constructor.
float getLength () const
 Gets the length of the vector.
float getSqrLength () const
 Gets the square length of the vector.
float getDistanceTo (const Gel2dVec &vec) const
 Gets the distance from this vector to another Gel2dVec.
float getDot (const Gel2dVec &vec) const
 Gets the dot product of this vector with another Gel2dVec.
void normalize ()
 Normalizes the vector.
Gel2dVec operator+ (const Gel2dVec &v) const
Gel2dVec operator- (const Gel2dVec &v) const
Gel2dVec operator* (const Gel2dVec &v) const
Gel2dVec operator/ (const Gel2dVec &v) const
Gel2dVec operator= (const Gel2dVec &v)
Gel2dVec operator+= (const Gel2dVec &v)
Gel2dVec operator-= (const Gel2dVec &v)
Gel2dVec operator*= (const Gel2dVec &v)
Gel2dVec operator/= (const Gel2dVec &v)
bool operator== (const Gel2dVec &v) const
bool operator!= (const Gel2dVec &v) const
bool operator< (const Gel2dVec &v) const
bool operator> (const Gel2dVec &v) const
bool operator<= (const Gel2dVec &v) const
bool operator>= (const Gel2dVec &v) const

Public Attributes

float x
 x coordinate.
float y
 y coordinate.

Detailed Description

2D vector class with lots of operators and a few useful functions.

This class can be used as a direction vector, or for positioning in 2D space. It is already extensively used internally by Gel2D as a means of forwarding spatial coordinates.


Constructor & Destructor Documentation

gel::Gel2dVec::Gel2dVec ( ) [inline]

Default constructor.

gel::Gel2dVec::Gel2dVec ( const Gel2dVec vec) [inline]

Copy constructor.

Parameters:
vec: The Gel2dVec to copy.
gel::Gel2dVec::Gel2dVec ( float  n) [inline]

Single value constructor.

Parameters:
n: Value to use for the vector's x and y coordinates.
gel::Gel2dVec::Gel2dVec ( float  _x,
float  _y 
) [inline]

Gel2dVec constructor.

Parameters:
_x: The vector's x coordinate.
_y: The vector's y coordinate.

Member Function Documentation

float gel::Gel2dVec::getLength ( ) const [inline]

Gets the length of the vector.

Returns:
The length of the vector.
float gel::Gel2dVec::getSqrLength ( ) const [inline]

Gets the square length of the vector.

Returns:
The length of the vector squared.
float gel::Gel2dVec::getDistanceTo ( const Gel2dVec vec) const [inline]

Gets the distance from this vector to another Gel2dVec.

Parameters:
vec: The Gel2dVec to get the distance to.
Returns:
The distance to vec.
float gel::Gel2dVec::getDot ( const Gel2dVec vec) const [inline]

Gets the dot product of this vector with another Gel2dVec.

Parameters:
vec: A Gel2dVec.
Returns:
The dot product.
void gel::Gel2dVec::normalize ( ) [inline]

Normalizes the vector.

Gel2dVec gel::Gel2dVec::operator+ ( const Gel2dVec v) const [inline]
Gel2dVec gel::Gel2dVec::operator- ( const Gel2dVec v) const [inline]
Gel2dVec gel::Gel2dVec::operator* ( const Gel2dVec v) const [inline]
Gel2dVec gel::Gel2dVec::operator/ ( const Gel2dVec v) const [inline]
Gel2dVec gel::Gel2dVec::operator= ( const Gel2dVec v) [inline]
Gel2dVec gel::Gel2dVec::operator+= ( const Gel2dVec v) [inline]
Gel2dVec gel::Gel2dVec::operator-= ( const Gel2dVec v) [inline]
Gel2dVec gel::Gel2dVec::operator*= ( const Gel2dVec v) [inline]
Gel2dVec gel::Gel2dVec::operator/= ( const Gel2dVec v) [inline]
bool gel::Gel2dVec::operator== ( const Gel2dVec v) const [inline]
bool gel::Gel2dVec::operator!= ( const Gel2dVec v) const [inline]
bool gel::Gel2dVec::operator< ( const Gel2dVec v) const [inline]
bool gel::Gel2dVec::operator> ( const Gel2dVec v) const [inline]
bool gel::Gel2dVec::operator<= ( const Gel2dVec v) const [inline]
bool gel::Gel2dVec::operator>= ( const Gel2dVec v) const [inline]

Member Data Documentation

x coordinate.

y coordinate.


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