Pyrogenesis  trunk
Public Member Functions | Public Attributes | List of all members
CFixedVector2D Class Reference

#include <FixedVector2D.h>

Collaboration diagram for CFixedVector2D:
Collaboration graph
[legend]

Public Member Functions

 CFixedVector2D ()
 
 CFixedVector2D (fixed X, fixed Y)
 
bool operator== (const CFixedVector2D &v) const
 Vector equality. More...
 
bool operator!= (const CFixedVector2D &v) const
 Vector inequality. More...
 
CFixedVector2D operator+ (const CFixedVector2D &v) const
 Vector addition. More...
 
CFixedVector2D operator- (const CFixedVector2D &v) const
 Vector subtraction. More...
 
CFixedVector2D operator- () const
 Negation. More...
 
CFixedVector2Doperator+= (const CFixedVector2D &v)
 Vector addition. More...
 
CFixedVector2Doperator-= (const CFixedVector2D &v)
 Vector subtraction. More...
 
CFixedVector2D operator* (int n) const
 Scalar multiplication by an integer. More...
 
CFixedVector2D operator/ (int n) const
 Scalar division by an integer. Must not have n == 0. More...
 
CFixedVector2D Multiply (fixed n) const
 Multiply by a CFixed. More...
 
fixed Length () const
 Returns the length of the vector. More...
 
int CompareLength (fixed cmp) const
 Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument. More...
 
int CompareLength (const CFixedVector2D &other) const
 Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument's length. More...
 
bool IsZero () const
 
void Normalize ()
 Normalize the vector so that length is close to 1. More...
 
void Normalize (fixed n)
 Normalize the vector so that length is close to n. More...
 
fixed Dot (const CFixedVector2D &v) const
 Compute the dot product of this vector with another. More...
 
CFixedVector2D Perpendicular () const
 
CFixedVector2D Rotate (fixed angle) const
 Rotate the vector by the given angle (anticlockwise). More...
 

Public Attributes

fixed X
 
fixed Y
 

Constructor & Destructor Documentation

CFixedVector2D::CFixedVector2D ( )
inline
CFixedVector2D::CFixedVector2D ( fixed  X,
fixed  Y 
)
inline

Member Function Documentation

int CFixedVector2D::CompareLength ( fixed  cmp) const
inline

Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument.

Avoids sqrting and overflowing.

int CFixedVector2D::CompareLength ( const CFixedVector2D other) const
inline

Returns -1, 0, +1 depending on whether length is less/equal/greater than the argument's length.

Avoids sqrting and overflowing.

fixed CFixedVector2D::Dot ( const CFixedVector2D v) const
inline

Compute the dot product of this vector with another.

bool CFixedVector2D::IsZero ( ) const
inline
fixed CFixedVector2D::Length ( ) const
inline

Returns the length of the vector.

Will not overflow if the result can be represented as type 'fixed'.

CFixedVector2D CFixedVector2D::Multiply ( fixed  n) const
inline

Multiply by a CFixed.

Likely to overflow if both numbers are large, so we use an ugly name instead of operator* to make it obvious.

void CFixedVector2D::Normalize ( )
inline

Normalize the vector so that length is close to 1.

If length is 0, does nothing.

void CFixedVector2D::Normalize ( fixed  n)
inline

Normalize the vector so that length is close to n.

If length is 0, does nothing.

bool CFixedVector2D::operator!= ( const CFixedVector2D v) const
inline

Vector inequality.

CFixedVector2D CFixedVector2D::operator* ( int  n) const
inline

Scalar multiplication by an integer.

CFixedVector2D CFixedVector2D::operator+ ( const CFixedVector2D v) const
inline

Vector addition.

CFixedVector2D& CFixedVector2D::operator+= ( const CFixedVector2D v)
inline

Vector addition.

CFixedVector2D CFixedVector2D::operator- ( const CFixedVector2D v) const
inline

Vector subtraction.

CFixedVector2D CFixedVector2D::operator- ( ) const
inline

Negation.

CFixedVector2D& CFixedVector2D::operator-= ( const CFixedVector2D v)
inline

Vector subtraction.

CFixedVector2D CFixedVector2D::operator/ ( int  n) const
inline

Scalar division by an integer. Must not have n == 0.

bool CFixedVector2D::operator== ( const CFixedVector2D v) const
inline

Vector equality.

CFixedVector2D CFixedVector2D::Perpendicular ( ) const
inline
CFixedVector2D CFixedVector2D::Rotate ( fixed  angle) const
inline

Rotate the vector by the given angle (anticlockwise).

Member Data Documentation

fixed CFixedVector2D::X
fixed CFixedVector2D::Y

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