Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
CFixedVector2D Class Reference

#include <FixedVector2D.h>

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 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)
 Compute the dot product of this vector with another. More...
 
CFixedVector2D Perpendicular ()
 
CFixedVector2D Rotate (fixed angle)
 Rotate the vector by the given angle (anticlockwise). More...
 

Public Attributes

fixed X
 
fixed Y
 

Detailed Description

Definition at line 24 of file FixedVector2D.h.

Constructor & Destructor Documentation

CFixedVector2D::CFixedVector2D ( )
inline

Definition at line 29 of file FixedVector2D.h.

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

Definition at line 30 of file FixedVector2D.h.

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.

Definition at line 118 of file FixedVector2D.h.

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.

Definition at line 141 of file FixedVector2D.h.

fixed CFixedVector2D::Dot ( const CFixedVector2D v)
inline

Compute the dot product of this vector with another.

Definition at line 195 of file FixedVector2D.h.

bool CFixedVector2D::IsZero ( ) const
inline

Definition at line 159 of file FixedVector2D.h.

fixed CFixedVector2D::Length ( ) const
inline

Returns the length of the vector.

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

Definition at line 95 of file FixedVector2D.h.

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.

Definition at line 86 of file FixedVector2D.h.

void CFixedVector2D::Normalize ( )
inline

Normalize the vector so that length is close to 1.

If length is 0, does nothing.

Definition at line 168 of file FixedVector2D.h.

void CFixedVector2D::Normalize ( fixed  n)
inline

Normalize the vector so that length is close to n.

If length is 0, does nothing.

Definition at line 182 of file FixedVector2D.h.

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

Vector inequality.

Definition at line 39 of file FixedVector2D.h.

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

Scalar multiplication by an integer.

Definition at line 77 of file FixedVector2D.h.

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

Vector addition.

Definition at line 45 of file FixedVector2D.h.

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

Vector addition.

Definition at line 63 of file FixedVector2D.h.

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

Vector subtraction.

Definition at line 51 of file FixedVector2D.h.

CFixedVector2D CFixedVector2D::operator- ( ) const
inline

Negation.

Definition at line 57 of file FixedVector2D.h.

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

Vector subtraction.

Definition at line 70 of file FixedVector2D.h.

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

Vector equality.

Definition at line 33 of file FixedVector2D.h.

CFixedVector2D CFixedVector2D::Perpendicular ( )
inline

Definition at line 209 of file FixedVector2D.h.

CFixedVector2D CFixedVector2D::Rotate ( fixed  angle)
inline

Rotate the vector by the given angle (anticlockwise).

Definition at line 217 of file FixedVector2D.h.

Member Data Documentation

fixed CFixedVector2D::X

Definition at line 27 of file FixedVector2D.h.

fixed CFixedVector2D::Y

Definition at line 27 of file FixedVector2D.h.


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