csVector2 Class Reference
[Geometry utilities]
A 2D vector.  
More...
#include <csgeom/vector2.h>
| Public Member Functions | |
| csVector2 (const csVector2 &o) | |
| Copyconstructor. | |
| csVector2 (float x, float y) | |
| Make a new vector and initialize with the given values. | |
| csVector2 (float v) | |
| Make a new vector and initialize with the given values. | |
| csVector2 () | |
| Make a new vector. No initialization is done. | |
| csString | Description () const | 
| Return a textual representation of the vector in the form "x,y". | |
| void | Get (float *v) | 
| Get the value of this vector. | |
| float | IsLeft (const csVector2 &p0, const csVector2 &p1) | 
| Test if this point is left of the line through p0 and p1. | |
| float | Norm () const | 
| Return the norm (magnitude) of this vector. | |
| csVector2 & | operator *= (float f) | 
| Multiply this vector by a scalar. | |
| csVector2 | operator+ () const | 
| Unary + operator. | |
| csVector2 & | operator+= (const csVector2 &v) | 
| Add another vector to this vector. | |
| csVector2 | operator- () const | 
| Unary - operator. | |
| csVector2 & | operator-= (const csVector2 &v) | 
| Subtract another vector from this vector. | |
| csVector2 & | operator/= (float f) | 
| Divide this vector by a scalar. | |
| float & | operator[] (int n) | 
| Returns n-th component of the vector. | |
| float | operator[] (int n) const | 
| Returns n-th component of the vector. | |
| void | Rotate (float angle) | 
| Rotate vector around the origin by a given angle in radians. | |
| void | Set (float v) | 
| Set the value of this vector so that all components are the same. | |
| void | Set (float const *v) | 
| Set the value of this vector. | |
| void | Set (csVector2 const &v) | 
| Set vector to given values. | |
| void | Set (float ix, float iy) | 
| Set vector to given values. | |
| float | SquaredNorm () const | 
| Return the squared norm (magnitude) of this vector. | |
| Static Public Member Functions | |
| static float | Norm (csVector2 const &v) | 
| Return the norm (magnitude) of a 2D vector. | |
| Public Attributes | |
| float | x | 
| X component of vector. | |
| float | y | 
| Y component of vector. | |
| Friends | |
| csVector2 | operator * (float f, const csVector2 &v) | 
| Multiply a vector and a scalar. | |
| csVector2 | operator * (const csVector2 &v, float f) | 
| Multiply a vector and a scalar. | |
| float | operator * (const csVector2 &v1, const csVector2 &v2) | 
| Take the dot product of two vectors. | |
| bool | operator!= (const csVector2 &v1, const csVector2 &v2) | 
| Check if two vectors are not equal. | |
| csVector2 | operator+ (const csVector2 &v1, const csVector2 &v2) | 
| Add two vectors. | |
| csVector2 | operator- (const csVector2 &v1, const csVector2 &v2) | 
| Subtract two vectors. | |
| csVector2 | operator/ (const csVector2 &v, float f) | 
| Divide a vector by a scalar. | |
| bool | operator< (const csVector2 &v, float f) | 
| Test if each component of a vector is less than a small epsilon value. | |
| bool | operator== (const csVector2 &v1, const csVector2 &v2) | 
| Check if two vectors are equal. | |
| 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 37 of file vector2.h.
Constructor & Destructor Documentation
| csVector2::csVector2 | ( | ) |  [inline] | 
| csVector2::csVector2 | ( | float | v | ) |  [inline] | 
| csVector2::csVector2 | ( | float | x, | |
| float | y | |||
| ) |  [inline] | 
| csVector2::csVector2 | ( | const csVector2 & | o | ) |  [inline] | 
Member Function Documentation
| csString csVector2::Description | ( | ) | const | 
Return a textual representation of the vector in the form "x,y".
| void csVector2::Get | ( | float * | v | ) |  [inline] | 
| float csVector2::Norm | ( | ) | const | 
Return the norm (magnitude) of this vector.
| static float csVector2::Norm | ( | csVector2 const & | v | ) |  [static] | 
| csVector2& csVector2::operator *= | ( | float | f | ) |  [inline] | 
| csVector2 csVector2::operator+ | ( | ) | const  [inline] | 
| csVector2 csVector2::operator- | ( | ) | const  [inline] | 
| csVector2& csVector2::operator/= | ( | float | f | ) |  [inline] | 
| float& csVector2::operator[] | ( | int | n | ) |  [inline] | 
| float csVector2::operator[] | ( | int | n | ) | const  [inline] | 
| void csVector2::Rotate | ( | float | angle | ) | 
Rotate vector around the origin by a given angle in radians.
| void csVector2::Set | ( | float | v | ) |  [inline] | 
| void csVector2::Set | ( | float const * | v | ) |  [inline] | 
| void csVector2::Set | ( | csVector2 const & | v | ) |  [inline] | 
| void csVector2::Set | ( | float | ix, | |
| float | iy | |||
| ) |  [inline] | 
Set vector to given values.
Definition at line 67 of file vector2.h.
Referenced by csShaderVariable::GetValue().
| float csVector2::SquaredNorm | ( | ) | const  [inline] | 
Return the squared norm (magnitude) of this vector.
Definition at line 90 of file vector2.h.
Referenced by csPlane2::SquaredDistance().
Friends And Related Function Documentation
Take the dot product of two vectors.
Check if two vectors are not equal.
| bool operator< | ( | const csVector2 & | v, | |
| float | f | |||
| ) |  [friend] | 
Check if two vectors are equal.
| bool operator> | ( | float | f, | |
| const csVector2 & | v | |||
| ) |  [friend] | 
Member Data Documentation
| float csVector2::x | 
X component of vector.
Definition at line 41 of file vector2.h.
Referenced by csPlane2::A(), csBox2::AddBoundingVertex(), csBox2::AddBoundingVertexSmart(), csBox2::AddBoundingVertexSmartTest(), csBox2::AddBoundingVertexTest(), csPoly2D::AddVertex(), csMath2::Area2(), csPlane2::Classify(), csBox2::Contains(), csBox2::In(), csBox2::Intersect(), csBoxClipper::IsInside(), IsLeft(), operator+=(), operator-=(), csBox2::Overlap(), csIntersect2::SegmentPlaneNoTest(), Set(), csPlane2::Set(), csShaderVariable::SetValue(), csBox2::StartBoundingBox(), and csMath2::WhichSide2D().
| float csVector2::y | 
Y component of vector.
Definition at line 43 of file vector2.h.
Referenced by csBox2::AddBoundingVertex(), csBox2::AddBoundingVertexSmart(), csBox2::AddBoundingVertexSmartTest(), csBox2::AddBoundingVertexTest(), csPoly2D::AddVertex(), csMath2::Area2(), csPlane2::B(), csPlane2::Classify(), csBox2::Contains(), csBox2::In(), csBox2::Intersect(), csBoxClipper::IsInside(), IsLeft(), operator+=(), operator-=(), csBox2::Overlap(), csIntersect2::SegmentPlaneNoTest(), Set(), csPlane2::Set(), csShaderVariable::SetValue(), and csMath2::WhichSide2D().
The documentation for this class was generated from the following file:
- csgeom/vector2.h
Generated for Crystal Space by doxygen 1.4.7

