CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csVector2 Class Reference
[Geometry utilities]

A 2D vector. More...

#include <vector2.h>

List of all members.

Public Methods

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

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

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

void Set (const csVector2 &v)
 Set vector to given values.

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

float SquaredNorm () const
 Return the squared 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.

csVector2 operator+ () const
 Unary + operator.

csVector2 operator- () const
 Unary - operator.


Static Public Methods

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


Friends

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

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

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

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

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

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

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

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

bool operator< (const csVector2 &v, float f)
 Test if each component of a vector is less than a small epsilon value.

bool operator> (float f, const csVector2 &v)
 Test if each component of a vector is greater than a small epsilon value.


Detailed Description

A 2D vector.

Definition at line 32 of file vector2.h.


Constructor & Destructor Documentation

csVector2::csVector2   [inline]
 

Make a new vector. No initialization is done.

Definition at line 41 of file vector2.h.

Referenced by operator-().

csVector2::csVector2 float    x,
float    y
[inline]
 

Make a new vector and initialize with the given values.

Definition at line 44 of file vector2.h.


Member Function Documentation

float csVector2::Norm  
 

Return the norm (magnitude) of this vector.

float csVector2::Norm const csVector2 &    v [static]
 

Return the norm (magnitude) of a 2D vector.

Referenced by csPlane2::Normalize().

csVector2& csVector2::operator *= float    f [inline]
 

Multiply this vector by a scalar.

Definition at line 76 of file vector2.h.

csVector2 csVector2::operator+   const [inline]
 

Unary + operator.

Definition at line 82 of file vector2.h.

csVector2& csVector2::operator+= const csVector2 &    v [inline]
 

Add another vector to this vector.

Definition at line 68 of file vector2.h.

References x, and y.

csVector2 csVector2::operator-   const [inline]
 

Unary - operator.

Definition at line 85 of file vector2.h.

References csVector2().

csVector2& csVector2::operator-= const csVector2 &    v [inline]
 

Subtract another vector from this vector.

Definition at line 72 of file vector2.h.

References x, and y.

csVector2& csVector2::operator/= float    f [inline]
 

Divide this vector by a scalar.

Definition at line 79 of file vector2.h.

void csVector2::Rotate float    angle
 

Rotate vector around the origin by a given angle in radians.

void csVector2::Set const csVector2 &    v [inline]
 

Set vector to given values.

Definition at line 51 of file vector2.h.

References x, and y.

void csVector2::Set float    ix,
float    iy
[inline]
 

Set vector to given values.

Definition at line 47 of file vector2.h.

Referenced by csShaderVariable::GetValue().

float csVector2::SquaredNorm   const [inline]
 

Return the squared norm (magnitude) of this vector.

Definition at line 61 of file vector2.h.

Referenced by csPlane2::SquaredDistance().


Friends And Related Function Documentation

csVector2 operator * float    f,
const csVector2 &    v
[friend]
 

Multiply a vector and a scalar.

csVector2 operator * const csVector2 &    v,
float    f
[friend]
 

Multiply a vector and a scalar.

float operator * const csVector2 &    v1,
const csVector2 &    v2
[friend]
 

Take the dot product of two vectors.

bool operator!= const csVector2 &    v1,
const csVector2 &    v2
[friend]
 

Check if two vectors are not equal.

csVector2 operator+ const csVector2 &    v1,
const csVector2 &    v2
[friend]
 

Add two vectors.

csVector2 operator- const csVector2 &    v1,
const csVector2 &    v2
[friend]
 

Subtract two vectors.

csVector2 operator/ const csVector2 &    v,
float    f
[friend]
 

Divide a vector by a scalar.

bool operator< const csVector2 &    v,
float    f
[friend]
 

Test if each component of a vector is less than a small epsilon value.

Definition at line 105 of file vector2.h.

bool operator== const csVector2 &    v1,
const csVector2 &    v2
[friend]
 

Check if two vectors are equal.

bool operator> float    f,
const csVector2 &    v
[friend]
 

Test if each component of a vector is greater than a small epsilon value.

Definition at line 109 of file vector2.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18