Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Public Attributes | Static Public Attributes
core::vector2d Class Reference

2d vector class with lots of operators and methods. More...

#include <Vector2d.h>

List of all members.

Public Member Functions

f32 dotProduct (const vector2d &other) const
 Returns the dot product of this vector with an other.
f32get ()
const f32get () const
f32 getAngle () const
f32 getAngleTrig () const
f32 getAngleWith (const vector2d &b) const
f32 getDistanceFrom (const vector2d &other) const
f32 getDistanceFromSQ (const vector2d &other) const
f32 getLength () const
 Returns the length of the vector.
f32 getLengthSQ () const
void invert ()
 Inverts the vector.
vector2dnormalize ()
 normalizes the vector.
bool operator!= (const vector2d &other) const
vector2d operator* (const vector2d &other) const
vector2d operator* (const f32 v) const
vector2doperator*= (const f32 v)
vector2doperator*= (const vector2d &other)
vector2d operator+ (const vector2d &other) const
vector2doperator+= (const vector2d &other)
vector2d operator- (const vector2d &other) const
vector2d operator- () const
vector2doperator-= (const vector2d &other)
vector2d operator/ (const f32 v) const
vector2d operator/ (const vector2d &other) const
vector2doperator/= (const f32 v)
vector2doperator/= (const vector2d &other)
vector2doperator= (const vector2d &other)
bool operator== (const vector2d &other) const
void rotateBy (f32 degrees, const vector2d &center)
 rotates the point around a center by an amount of degrees.
void set (const vector2d &other)
void set (const f32 &nx, const f32 &ny)
void setLength (f32 newLength)
 Sets the length of the vector to a new value.
 vector2d (f32 nx, f32 ny)
 vector2d ()
 vector2d (const vector2d &other)

Public Attributes

f32 X
f32 Y

Static Public Attributes

static const vector2d ORIGIN_2D = vector2d(0.0f, 0.0f)
 ORIGIN_2D is a const vector2d that defines the 2d origin vector for the 2d space.

Detailed Description

2d vector class with lots of operators and methods.


Constructor & Destructor Documentation

core::vector2d::vector2d ( )
core::vector2d::vector2d ( f32  nx,
f32  ny 
)
core::vector2d::vector2d ( const vector2d other)

Member Function Documentation

f32 core::vector2d::dotProduct ( const vector2d other) const

Returns the dot product of this vector with an other.

References X, and Y.

const f32 * core::vector2d::get ( ) const

References X.

f32 * core::vector2d::get ( )

References X.

Referenced by render::Shader::setParamerter().

f32 core::vector2d::getAngle ( ) const

Calculates the angle of this vector in grad in the counter trigonometric sense.

Returns:
Returns a value between 0 and 360.

References core::atan(), getLength(), core::RADTODEG, core::sqrt(), X, and Y.

f32 core::vector2d::getAngleTrig ( ) const

Calculates the angle of this vector in grad in the trigonometric sense. This method has been suggested by Pr3t3nd3r.

Returns:
Returns a value between 0 and 360.

References core::atan(), core::RADTODEG, X, and Y.

f32 core::vector2d::getAngleWith ( const vector2d b) const

Calculates the angle between this vector and another one in grad.

Returns:
Returns a value between 0 and 90.

References core::atan(), core::RADTODEG, core::sqrt(), X, and Y.

Referenced by core::line2d::getAngleWith().

f32 core::vector2d::getDistanceFrom ( const vector2d other) const

Returns distance from an other point. Here, the vector is interpreted as point in 2 dimensional space.

References core::sqrt(), X, and Y.

Referenced by core::line2d::getLength().

f32 core::vector2d::getDistanceFromSQ ( const vector2d other) const

Returns squared distance from an other point. Here, the vector is interpreted as point in 2 dimensional space.

References X, and Y.

f32 core::vector2d::getLength ( ) const

Returns the length of the vector.

References core::sqrt(), X, and Y.

Referenced by getAngle(), normalize(), and setLength().

f32 core::vector2d::getLengthSQ ( ) const

Returns squared length of the vector. This is useful because it is much faster then getLength().

References X, and Y.

void core::vector2d::invert ( )

Inverts the vector.

References X, and Y.

vector2d & core::vector2d::normalize ( )

normalizes the vector.

References core::EPSILON, getLength(), X, and Y.

bool core::vector2d::operator!= ( const vector2d other) const

References core::EPSILON, X, and Y.

vector2d core::vector2d::operator* ( const f32  v) const

References vector2d(), X, and Y.

vector2d core::vector2d::operator* ( const vector2d other) const

References vector2d(), X, and Y.

vector2d & core::vector2d::operator*= ( const vector2d other)

References X, and Y.

vector2d & core::vector2d::operator*= ( const f32  v)

References X, and Y.

vector2d core::vector2d::operator+ ( const vector2d other) const

References vector2d(), X, and Y.

vector2d & core::vector2d::operator+= ( const vector2d other)

References X, and Y.

vector2d core::vector2d::operator- ( const vector2d other) const

References vector2d(), X, and Y.

vector2d core::vector2d::operator- ( ) const

References vector2d(), X, and Y.

vector2d & core::vector2d::operator-= ( const vector2d other)

References X, and Y.

vector2d core::vector2d::operator/ ( const vector2d other) const

References vector2d(), X, and Y.

vector2d core::vector2d::operator/ ( const f32  v) const

References vector2d(), X, and Y.

vector2d & core::vector2d::operator/= ( const f32  v)

References X, and Y.

vector2d & core::vector2d::operator/= ( const vector2d other)

References X, and Y.

vector2d & core::vector2d::operator= ( const vector2d other)

References X, and Y.

bool core::vector2d::operator== ( const vector2d other) const

References core::EPSILON, X, and Y.

void core::vector2d::rotateBy ( f32  degrees,
const vector2d center 
)

rotates the point around a center by an amount of degrees.

References core::cos(), core::DEGTORAD, core::sin(), X, and Y.

void core::vector2d::set ( const vector2d other)

References X, and Y.

void core::vector2d::set ( const f32 nx,
const f32 ny 
)

References X, and Y.

Referenced by core::line2d::set().

void core::vector2d::setLength ( f32  newLength)

Sets the length of the vector to a new value.

References core::EPSILON, getLength(), X, and Y.


Member Data Documentation

const vector2d core::vector2d::ORIGIN_2D = vector2d(0.0f, 0.0f) [static]

ORIGIN_2D is a const vector2d that defines the 2d origin vector for the 2d space.


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:07 by Doxygen (1.7.4)