Normalized

inline Vec2D Normalized() const

Returns a normalized copy of the vector.

The normalized version of the vector has the same angle but its length is one. Instead of this function you could also use the ~ -operator.

Examples

// Create a new vector called theVector with x = 15.0 and y = 20.0 //
Vec2D theVector( 15.020.0 ); 

// Get a normalized copy of the vector //
Vec2D normalizedCopy = theVector.Normalized();

// The same as above by using the ~ -operator //
Vec2D normalizedCopy = ~theVector;


Other functions of the class Vec2D
GetMagnitude
Returns the magnitude (length) of the vector
GetAngle
Returns the angle of the vector
Normalized
Returns a normalized copy of the vector

Advanced functions

GetMagnitudeSquared
Returns the squared magnitude of the vector


Questions about Normalized? Click here.