//returns the length of the vector
inline double Length()const;
//returns the squared length of the vector (thereby avoiding the sqrt)
inline double LengthSq()const;
inline void Normalize();
//returns the dot product of this and v2
inline double Dot(const Vector2D& v2)const;
//returns positive if v2 is clockwise of this vector,
//negative if counterclockwise (assuming the Y axis is pointing down,
//X axis to right like a Window app)
inline int Sign(const Vector2D& v2)const;
//returns the vector that is perpendicular to this one
inline Vector2D Perp()const;
//adjusts x and y so that the length of the vector does not exceed max
inline void Truncate(double max);
//returns the distance between this vector and the one passed as a parameter
inline double Distance(const Vector2D &v2)const;
//squared version of above
inline double DistanceSq(const Vector2D &v2)const;
//returns the vector that is the reverse of this vector
inline Vector2D GetReverse()const;
//we need some operators
const Vector2D& operator+=(const Vector2D &rhs);
const Vector2D& operator=(const Vector2D &rhs);
const Vector2D& operator*=(const double& rhs);
const Vector2D& operator/=(const double& rhs;
bool operator==(const Vector2D& rhs)const;
bool operator!=(const Vector2D& rhs)const;
};
Local Space and World Space
It’s important you understand the difference between local space and world
space. The world space representation is normally what you see rendered
to your screen. Every object is defined by a position and orientation rela

tive to the origin of the world coordinate system (see Figure 1.23). A
soldier is using world space when he describes the position of a tank with a
grid reference, for instance.
26  Chapter 1
Mathematics