Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

TVector2 Class Template Reference
[Math2]

Template class for 2D vectors. More...

#include <gmlvector2.h>

List of all members.

Element access

T & operator[] (int i)
const T & operator[] (int i) const
void SetValue (double x0, double y0)
 Set elements by 2 double components.

void SetValue (double a)
 Set all the elements to the same T value.

 GetDim ()

Public Member Functions

Constructors
 TVector2 ()
 No initialization.

 TVector2 (double v)
 Initialization by scalar.

 TVector2 (double x0, double y0)
 Initialization by given components.

 TVector2 (const TVector3< T > &u)
Conversions
 operator T * ()
 Convert a TVector to array of (2) elements.

 operator const T * () const
 Convert a TVector to array of (2) elements.

Binary operations
TVector2< T > & operator+= (const TVector2< T > &u)
TVector2< T > & operator-= (const TVector2< T > &u)
TVector2< T > operator+ (const TVector2< T > &u) const
TVector2< T > operator- (const TVector2< T > &u) const
TVector2< T > & operator *= (const double d)
TVector2< T > & operator/= (const double d)
TVector2< T > MultVec (const TVector2< T > &u) const
 Vector scaling (this vector is not modified).

TVector2< T > DivVec (const TVector2< T > &u) const
 Vector-by vector division (this vector is not modified).

TVector2< T > operator * (const double d) const
TVector2< T > operator/ (const double d) const
double operator * (const TVector2< T > &rhs) const
 dot product

double operator^ (const TVector2< T > &rhs) const
 cross product

double DotProduct (const TVector2< T > &rhs) const
 dot product

double CrossProduct (const TVector2< T > &rhs) const
 cross product

Unary operations
void Negate ()
 Vector (self) negation.

TVector2< T > operator- () const
Service methods
void Clip (double vmin, double vmax)
 Clip elements of this TVector to constraints from vmin to vmax.

TVector2< double > operator~ () const
 returns normalized vector (always double)

TVector2< T > & Normalize ()
 Normalize this vector, return vector itself.

bool Normalized () const
 Test whether the TVector is normalized.

double SqrLength () const
 Squared length of vector.

double Length () const
 Length of the vector.

bool LessOrEqual (const TVector2< T > &u) const
 Return true if all components of this vector less of equal than u.

double operator! () const
 Length of the vector.

TVector2< T > NormalRight () const
 Returns normal N to this vector, such that DotProduct(*this, N) = 0.

MFC, VCL, OWL - specific functions (defined only if proper defines are found)
 TVector2 (const TPoint &p)
TVector2< T > & operator= (const TPoint &p)
 operator TPoint ()
 TVector2 (const CPoint &p)
 TVector2 (const POINT &p)
 TVector2 (const CSize &p)
TVector2< T > & operator= (const CPoint &p)
TVector2< T > & operator= (const POINT &p)
TVector2< T > & operator= (const CSize &p)
 operator CPoint ()
 operator CvPoint ()
 operator CvSize ()
 TVector2 (const CvPoint &p)
TVector2 operator= (const CvPoint &p)

Static Public Member Functions

const TVector2< T > & Cast (const T *u)
 Treat array of (2) elements as a TVector.

TVector2< T > & Cast (T *u)
 Treat array of (2) elements as a TVector.


Related Functions

(Note that these are not member functions.)

TVector2< T > operator * (const double d, const TVector2< T > &u)
 Multiplication of scalar d by TVector u.

double SqrLength (const TVector2< T > &u)
 Squared length of given vector.

double Length (const TVector2< T > &u)
 Length of the vector.

double DotProd (const TVector2< T > &v1, const TVector2< T > &v2)
 Dot product.

double DotProduct (const TVector2< T > &v1, const TVector2< T > &v2)
 Dot product.

double CrossProd (const TVector2< T > &v1, const TVector2< T > &v2)
 Cross product.

double CrossProduct (const TVector2< T > &v1, const TVector2< T > &v2)
 Cross product.

double Cos (const TVector2< T > &a, const TVector2< T > &b)
 cos between two vectors

double Sin (const TVector2< T > &a, const TVector2< T > &b)
 sin between two vectors

TVector2< T_TO > Conv (const TVector2< T_FROM > &u)
 Convert TVector2<T_FROM> to TVector2<T_TO>.

TVector2< float > ConvF (const TVector2< T > &u)
 Convert TVector2<T> to TVector2<float>.

TVector2< double > ConvD (const TVector2< T > &u)
 Convert TVector2<T> to TVector2<double>.

TVector2< int > ConvI (const TVector2< T > &u)
 Convert TVector2<T> to TVector2<int>.

TVector2< short > ConvS (const TVector2< T > &u)
 Convert TVector2<T> to TVector2<int>.


Detailed Description

template<class T>
class gml::TVector2< T >

Template class for 2D vectors.

Parameters:
T - template type of TVector elements
Warning:
Use it with some SIGNED integral type, or a real type


Member Function Documentation

TVector2<T> NormalRight  )  const [inline]
 

Returns normal N to this vector, such that DotProduct(*this, N) = 0.

Parameters:
def - vector returned if the length of this vector is near zero
Note:
Projection of the resulting vector to the X axis will have the same sign that projection of this vector. If x = 0, then normal will be equal (1,0)


The documentation for this class was generated from the following file:
Generated on Tue Jan 13 21:12:07 2004 for Graphics and Media Lab CSL by doxygen 1.3.4