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

anoid::simple::Vector Class Reference

#include <vector.hh>

Inheritance diagram for anoid::simple::Vector:

Inheritance graph
[legend]
Collaboration diagram for anoid::simple::Vector:

Collaboration graph
[legend]
List of all members.

Public Methods

 Vector (double getx=0, double gety=0, double getz=0)
 Vector (std::string &s)
 Vector (char *s)
double getNorm () const
void setNorm (double newnorm)
void scale (const Vector &v)
Vector operator= (const Vector &a)

Private Methods

void init (const char *s)

Friends

Vector operator+ (const Vector &a, const Vector &b)
Vector operator+= (Vector &a, const Vector &b)
Vector operator- (const Vector &a, const Vector &b)
Vector operator * (const double c, const Vector &a)
Vector operator * (const Vector &a, const double c)
Vector operator * (const double *d, const Vector &a)
Vector operator * (const Vector &a, const double *d)
double operator * (const Vector &a, const Vector &b)
Vector operator% (const Vector &a, const Vector &b)
std::ostream & operator<< (std::ostream &s, const Vector &a)

Detailed Description

gives a 3 dimentional vector

Definition at line 15 of file vector.hh.


Constructor & Destructor Documentation

anoid::simple::Vector::Vector double    getx = 0,
double    gety = 0,
double    getz = 0
 

Constructor Creates a 3 dimentional vector

Parameters:
getx  the first coordinate of the vector
gety  the second coodinate of the vector
getz  the third coordinate of the vector

Definition at line 19 of file vector.cc.

Referenced by Vertex::Vertex().

anoid::simple::Vector::Vector std::string &    s
 

Definition at line 22 of file vector.cc.

References init().

anoid::simple::Vector::Vector char *    s
 

Definition at line 26 of file vector.cc.

References init().


Member Function Documentation

double anoid::simple::Vector::getNorm  
 

getNorm gives the norm of the vector

Returns:
the norm of the vector a double

Definition at line 30 of file vector.cc.

Referenced by setNorm().

void anoid::simple::Vector::init const char *    s [private]
 

Definition at line 12 of file vector.cc.

References anoid::simple::Point::x, anoid::simple::Point::y, and anoid::simple::Point::z.

Referenced by Vector().

Vector anoid::simple::Vector::operator= const Vector &    a
 

operator= copy one vector to another

Parameters:
a  the vector top copy
Returns:
this vector, which is now a copy of the second

Definition at line 58 of file vector.cc.

References anoid::simple::Point::x, anoid::simple::Point::y, and anoid::simple::Point::z.

void anoid::simple::Vector::scale const Vector &    v
 

scale scale this vector by the x, y, and z values obtained from v

Parameters:
v  the vector to give the scaling

Definition at line 41 of file vector.cc.

References anoid::simple::Point::x, anoid::simple::Point::y, and anoid::simple::Point::z.

void anoid::simple::Vector::setNorm double    newnorm
 

setNorm creates a vector with the same direction as the vector but with norm newnorm

Parameters:
newnorm  the required norm for the vector

Definition at line 34 of file vector.cc.

References getNorm(), anoid::simple::Point::x, anoid::simple::Point::y, and anoid::simple::Point::z.


Friends And Related Function Documentation

double operator * const Vector &    a,
const Vector &    b
[friend]
 

operator * calculates the dot-product between two vectors

Parameters:
a  the first vector
b  the second vector
Returns:
the dot-product between a and b - a double

Definition at line 77 of file vector.cc.

Vector operator * const Vector &    a,
const double *    d
[friend]
 

Multiply vector with a matrix from the right. The matrix is assumed to be a 4x4 matrix as a double[16] in column-major order (like for OpenGL). Only the upper left 3x3 part of the matrix is used.

Parameters:
a  the vector v
d  the matrix A
Returns:
the vector (v*A)*

Definition at line 96 of file vector.cc.

Vector operator * const double *    d,
const Vector &    a
[friend]
 

Multiply vector with a matrix from the left. The matrix is assumed to be a 4x4 matrix as a double[16] in column-major order (like for OpenGL). Only the upper left 3x3 part of the matrix is used.

Parameters:
d  the matrix A
a  the vector v
Returns:
the vector Av

Definition at line 90 of file vector.cc.

Vector operator * const Vector &    a,
const double    c
[friend]
 

operator * calculates the vector where all coordinates have been multiplied by c from right

Parameters:
a  the vector that is to be multiplied
c  the constant to multiply the vector coordinates by
Returns:
a*c - a new vector

Definition at line 73 of file vector.cc.

Vector operator * const double    c,
const Vector &    a
[friend]
 

operator * calculates the vector where all coordinates have been multiplied by c from left

Parameters:
c  the constant to multiply the vector coordinates by
a  the vector that is to be multiplied
Returns:
c*a - a new vector

Definition at line 69 of file vector.cc.

Vector operator% const Vector &    a,
const Vector &    b
[friend]
 

operator% calculates the cross product of two vectors

Parameters:
a  the first vector
b  the second vector
Returns:
the cross product between a and b - a vector

Definition at line 81 of file vector.cc.

Vector operator+ const Vector &    a,
const Vector &    b
[friend]
 

operator+ adds two vectors

Parameters:
a  the first vector
b  the second vector
Returns:
the sum of the two vectors - a new vector

Definition at line 47 of file vector.cc.

Vector operator+= Vector &    a,
const Vector &    b
[friend]
 

operator+= adds two vectors, save value in first

Parameters:
a  the first vector
b  the second vector
Returns:
the sum of the two vectors this is the same as a

Definition at line 51 of file vector.cc.

Vector operator- const Vector &    a,
const Vector &    b
[friend]
 

operator- substract two vectors

Parameters:
a  the first vector
b  the second vector
Returns:
a-b - a new vector

Definition at line 65 of file vector.cc.

std::ostream& operator<< std::ostream &    s,
const Vector &    a
[friend]
 

operator<< prints the vector

Parameters:
s  the ostream where a is send to
a  the vector to be printed
Returns:
the ostream

Definition at line 85 of file vector.cc.


The documentation for this class was generated from the following files:
Anoid NG © Michael Westergaard, Martin Stig Stissing, Ronni Michael Laursen, and Kristian Bisgaard Lassen