sonus::Vector2D Class Reference

#include <Vector2D.h>

Inheritance diagram for sonus::Vector2D:

sonus::Element2D

List of all members.

Public Member Functions

 Vector2D ()
 Vector2D (const Vector2D *v)
 Vector2D (double x, double y)
 Vector2D (double arr[])
Vector2DsetTo (double x, double y)
Vector2DsetTo (double a[])
Vector2DsetTo (Vector2D *v)
Vector2DsetTo (Vector2D v)
Vector2Dunify ()
double magnitude ()
double dot (Vector2D v)
Vector2Dtransform (double transmatrix[16])
Vector2DinvTransform (double transmatrix[16])
void toArray (double *arr)
char * toString ()
Vector2Drotate (double angle)
Vector2Dnormal ()
Vector2Doperator= (Vector2D v2)
Vector2Doperator+= (Vector2D v2)
Vector2Doperator+= (short s)
Vector2Doperator+= (int i)
Vector2Doperator+= (long l)
Vector2Doperator+= (float f)
Vector2Doperator+= (double d)
Vector2Doperator-= (Vector2D v2)
Vector2Doperator-= (short s)
Vector2Doperator-= (int i)
Vector2Doperator-= (long l)
Vector2Doperator-= (float f)
Vector2Doperator-= (double d)
Vector2Doperator *= (Vector2D v2)
Vector2Doperator *= (short s)
Vector2Doperator *= (int i)
Vector2Doperator *= (long l)
Vector2Doperator *= (float f)
Vector2Doperator *= (double d)
Vector2Doperator/= (Vector2D v2)
Vector2Doperator/= (short s)
Vector2Doperator/= (int i)
Vector2Doperator/= (long l)
Vector2Doperator/= (float f)
Vector2Doperator/= (double d)
Vector2D operator+ (Vector2D v2)
Vector2D operator+ (short s)
Vector2D operator+ (int i)
Vector2D operator+ (long l)
Vector2D operator+ (float f)
Vector2D operator+ (double d)
Vector2D operator- (Vector2D v2)
Vector2D operator- (short s)
Vector2D operator- (int i)
Vector2D operator- (long l)
Vector2D operator- (float f)
Vector2D operator- (double d)
Vector2D operator * (Vector2D v2)
Vector2D operator * (short s)
Vector2D operator * (int i)
Vector2D operator * (long l)
Vector2D operator * (double d)
Vector2D operator * (float f)
Vector2D operator/ (Vector2D v2)
Vector2D operator/ (short s)
Vector2D operator/ (int i)
Vector2D operator/ (long l)
Vector2D operator/ (double d)
Vector2D operator/ (float f)

Public Attributes

double x
double y

Friends

Vector2D operator+ (short s, Vector2D v)
Vector2D operator+ (int i, Vector2D v)
Vector2D operator+ (long l, Vector2D v)
Vector2D operator+ (float f, Vector2D v)
Vector2D operator+ (double d, Vector2D v)
Vector2D operator- (short s, Vector2D v)
Vector2D operator- (int i, Vector2D v)
Vector2D operator- (long l, Vector2D v)
Vector2D operator- (float f, Vector2D v)
Vector2D operator- (double d, Vector2D v)
Vector2D operator * (short s, Vector2D v)
Vector2D operator * (int i, Vector2D v)
Vector2D operator * (long l, Vector2D v)
Vector2D operator * (float f, Vector2D v)
Vector2D operator * (double d, Vector2D v)
Vector2D operator/ (short s, Vector2D v)
Vector2D operator/ (int i, Vector2D v)
Vector2D operator/ (long l, Vector2D v)
Vector2D operator/ (float f, Vector2D v)
Vector2D operator/ (double d, Vector2D v)


Detailed Description

sonus::Vector2D

A mathematical two dimensional vector with all important functions.

filename: Vector2D.h

Date:
2008/04/27 18:09
Author:
Alexander Lawrence
Version:
1.0

Constructor & Destructor Documentation

sonus::Vector2D::Vector2D (  ) 

Constructor

sonus::Vector2D::Vector2D ( const Vector2D v  ) 

Copy constructor

Parameters:
v the vector to be copied

sonus::Vector2D::Vector2D ( double  x,
double  y 
)

Constructor with doubles

Parameters:
x x value
y y value

sonus::Vector2D::Vector2D ( double  arr[]  ) 

Constructor with array

Parameters:
arr double array with length of 2


Member Function Documentation

Vector2D* sonus::Vector2D::setTo ( double  x,
double  y 
)

Sets vector to given double values

Parameters:
x x value
y y value
Returns:
pointer to vector itself

Vector2D* sonus::Vector2D::setTo ( double  a[]  ) 

Sets vector to given array values

Parameters:
a double array with length of 2
Returns:
pointer to vector itself

Vector2D* sonus::Vector2D::setTo ( Vector2D v  ) 

Sets vector to given vector pointer values

Parameters:
v the vector pointer to be copied
Returns:
pointer to vector itself

Vector2D* sonus::Vector2D::setTo ( Vector2D  v  ) 

Sets vector to given vector values

Parameters:
v the vector to be copied
Returns:
pointer to vector itself

Vector2D* sonus::Vector2D::unify (  ) 

Unifies the vector. This means the vector is divided by his length, which leaves it with a total length of 1.

Returns:
pointer to vector itself

double sonus::Vector2D::magnitude (  ) 

Calculates the magnitude of the vector. Used in unify().

Returns:
magnitude the magnitude

double sonus::Vector2D::dot ( Vector2D  v  ) 

Calculates the dot product of self and given vector.

Parameters:
v the 2nd vector
Returns:
the dot product of the vector itself and the 2nd vector

Vector2D* sonus::Vector2D::transform ( double  transmatrix[16]  ) 

Transforms a vector by given transformation matrix. Used by the Haptics module to transform the device workspace to the application workspace.

Parameters:
transmatrix double array with a length of 16
See also:
sonus::Haptics

Vector2D* sonus::Vector2D::invTransform ( double  transmatrix[16]  ) 

Invert transforms a vector by given transformation matrix. Used by the Haptics module to transform the device workspace to the application workspace.

Parameters:
transmatrix double array with a length of 16
See also:
sonus::Haptics

void sonus::Vector2D::toArray ( double *  arr  ) 

Converts the vector to an array.

Parameters:
arr out parameter: the array the values to be saved in

char* sonus::Vector2D::toString (  )  [virtual]

Only for testing and debugging.

Returns:
meta string

Reimplemented from sonus::Element2D.

Vector2D* sonus::Vector2D::rotate ( double  angle  ) 

Rotates a vector by given angle.

Parameters:
angle the angle the vector to be rotated
Returns:
the vector itself

Vector2D* sonus::Vector2D::normal (  ) 

Calculates the normal vector. In two dimensional space there is only one normal to a vector. The normal is perpendicular to the vector.

Returns:
the normal vector


The documentation for this class was generated from the following file:
Generated on Tue Aug 26 12:26:54 2008 for sonus by  doxygen 1.5.4