In file include/csgeom/math2d.h:

class csVector2

A 2D vector

Public Fields

float x
float y

Public Methods

csVector2(float x, float y)
Make a new vector and initialize with the given values.
csVector2()
Make a new vector. No initialization is done.
float Norm()
Return the norm (magnitude) of this vector.
static float Norm(const csVector2& v)
Return the norm (magnitude) of a 2D vector.
friend bool operator!= (const csVector2& v1, const csVector2& v2)
Check if two vectors are not equal.
friend csVector2 operator* (float f, const csVector2& v)
Multiply a vector and a scalar.
friend csVector2 operator* (const csVector2& v, float f)
Multiply a vector and a scalar.
friend float operator* (const csVector2& v1, const csVector2& v2)
Take the dot product of two vectors.
csVector2& operator*= (float f)
Multiply this vector by a scalar.
inline csVector2 operator+ ()
Unary + operator.
friend csVector2 operator+ (const csVector2& v1, const csVector2& v2)
Add two vectors.
csVector2& operator+= (const csVector2& v)
Add another vector to this vector.
inline csVector2 operator- ()
Unary - operator.
friend csVector2 operator- (const csVector2& v1, const csVector2& v2)
Subtract two vectors.
csVector2& operator-= (const csVector2& v)
Subtract another vector from this vector.
friend csVector2 operator/ (const csVector2& v, float f)
Divide a vector by a scalar.
csVector2& operator/= (float f)
Divide this vector by a scalar.
friend bool operator== (const csVector2& v1, const csVector2& v2)
Check if two vectors are equal.
void Rotate(float angle)
Rotate vector around the origin by a given angle in radians.
inline void Set(float ix, float iy)
Set vector to given values.

Documentation

A 2D vector
float x

float y

csVector2()
Make a new vector. No initialization is done.

csVector2(float x, float y)
Make a new vector and initialize with the given values.

inline void Set(float ix, float iy)
Set vector to given values.

static float Norm(const csVector2& v)
Return the norm (magnitude) of a 2D vector.

float Norm()
Return the norm (magnitude) of this vector.

void Rotate(float angle)
Rotate vector around the origin by a given angle in radians.

csVector2& operator+= (const csVector2& v)
Add another vector to this vector.

csVector2& operator-= (const csVector2& v)
Subtract another vector from this vector.

csVector2& operator*= (float f)
Multiply this vector by a scalar.

csVector2& operator/= (float f)
Divide this vector by a scalar.

inline csVector2 operator+ ()
Unary + operator.

inline csVector2 operator- ()
Unary - operator.

friend csVector2 operator+ (const csVector2& v1, const csVector2& v2)
Add two vectors.

friend csVector2 operator- (const csVector2& v1, const csVector2& v2)
Subtract two vectors.

friend float operator* (const csVector2& v1, const csVector2& v2)
Take the dot product of two vectors.

friend csVector2 operator* (const csVector2& v, float f)
Multiply a vector and a scalar.

friend csVector2 operator* (float f, const csVector2& v)
Multiply a vector and a scalar.

friend csVector2 operator/ (const csVector2& v, float f)
Divide a vector by a scalar.

friend bool operator== (const csVector2& v1, const csVector2& v2)
Check if two vectors are equal.

friend bool operator!= (const csVector2& v1, const csVector2& v2)
Check if two vectors are not equal.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de