KurusView  1.0
MVector Class Reference

Public Member Functions

 MVector ()
 default constructor - Initializes coordinates to zero
 
 MVector (double x, double y, double z)
 constructor - Initializes coordinates
 
 MVector (double x, double y, double z, long int id)
 constructor - Initializes coordinates and vector ID
 
 ~MVector ()=default
 default destructor
 
double getX () const
 getX (accessor) More...
 
double getY () const
 getY (accessor) More...
 
double getZ () const
 getZ (accessor) More...
 
void setX (double x)
 setX - Sets x-coordinate of vector
 
void setY (double y)
 setY - Sets y-coordinate of vector
 
void setZ (double z)
 setZ - Sets z-coordinate of vector
 
MVector operator+ (const MVector &obj) const
 operator+ - overloads the + operator to add two vectors directly together More...
 
MVector operator- (const MVector &obj) const
 operator- - overloads the - operator to add two vectors directly together More...
 
MVector operator* (const MVector &obj) const
 operator* - overloads the * operator to find the cross product between two vectors More...
 
MVector operator* (const double &scalar) const
 operator* - overloads the * operator to multiply a vector by a scalar More...
 
MVector operator/ (const double &scalar) const
 operator/ - overloads the / operator to divide a vector by a scalar More...
 
double getModulus () const
 getModulus - obtains the modulus of an MVector More...
 
long int getID () const
 getID More...
 
const double & operator[] (int index) const
 
bool operator== (const MVector &v) const
 
bool operator!= (const MVector &v) const
 

Friends

std::ostream & operator<< (std::ostream &os, MVector &obj)
 classic friend overloaded ostream operator<< declaration - prints MVector properties to stdout in human friendly format More...
 
std::ofstream & operator<< (std::ofstream &os, MVector &obj)
 classic friend overloaded ofstream operator<< declaration - prints MVector properties to file in Model Loader parser format More...
 

Member Function Documentation

long int MVector::getID ( ) const

getID

Returns
- ID member variable
double MVector::getModulus ( ) const

getModulus - obtains the modulus of an MVector

Returns
- Modulus of MVector
double MVector::getX ( ) const

getX (accessor)

Returns
- x-coordinate
double MVector::getY ( ) const

getY (accessor)

Returns
- y-coordinate
double MVector::getZ ( ) const

getZ (accessor)

Returns
- z-coordinate
MVector MVector::operator* ( const MVector obj) const

operator* - overloads the * operator to find the cross product between two vectors

Parameters
obj- MVector instance to find the cross product with the called object MVector
Returns
- Result of the cross product being an MVector
MVector MVector::operator* ( const double &  scalar) const

operator* - overloads the * operator to multiply a vector by a scalar

Parameters
scalar- a double value to multiply an MVector with
Returns
- MVector multiplied by a scalar
MVector MVector::operator+ ( const MVector obj) const

operator+ - overloads the + operator to add two vectors directly together

Parameters
obj- MVector instance to add to the called object MVector
Returns
- MVector that is a result of two added vectors
MVector MVector::operator- ( const MVector obj) const

operator- - overloads the - operator to add two vectors directly together

Parameters
obj- MVector instance to subtract to the called object MVector
Returns
- MVector that is a result of two subtracted vectors
MVector MVector::operator/ ( const double &  scalar) const

operator/ - overloads the / operator to divide a vector by a scalar

Parameters
scalar- a double value to divide an MVector with
Returns
- MVector multiplied by a scalar

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
MVector obj 
)
friend

classic friend overloaded ostream operator<< declaration - prints MVector properties to stdout in human friendly format

Parameters
os- lhs element [ a.operator<<(b) ], might be std::cout or see return
obj- MVector instance
Returns
- os reference for cascading <<
std::ofstream& operator<< ( std::ofstream &  os,
MVector obj 
)
friend

classic friend overloaded ofstream operator<< declaration - prints MVector properties to file in Model Loader parser format

Parameters
os- lhs element [ a.operator<<(b) ], might be std::cout or see return
obj- MVector instance
Returns
- os reference for cascading <<

The documentation for this class was generated from the following files: