ADBLib  0.5
A simple library for rapid robot code development
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
ADBLib::Vector3D Class Reference

#include <Vector3D.h>

Public Member Functions

 Vector3D ()
 Constructor. Sets y and z to 0, and x to 1. More...
 
 Vector3D (double newX, double newY, double newZ)
 Constructor. Lets you set initial component values. More...
 
void normalize ()
 Normalizes the vector, preserving the direction but setting magnitude to 1. More...
 
double mag () const
 Returns the magnitude of the vector. More...
 
void setMag (double newMag)
 Sets the magnitude of the vector. More...
 
double getADelt (Vector3D vec) const
 Gets the angle between two vectors. More...
 
void rotateX (double rad)
 Rotates the vector about the X axis. More...
 
void rotateY (double rad)
 Rotates the vector about the Y axis. More...
 
void rotateZ (double rad)
 Rotates the vector about the Z axis. More...
 
Vector3D operator+ (const Vector3D &vec) const
 Standard vector addition. More...
 
Vector3D operator- (const Vector3D &vec) const
 Standard vector subtraction. More...
 
double operator* (const Vector3D &vec) const
 Vector dot product. More...
 
Vector3D operator* (const double &num) const
 
Vector3D operator% (const Vector3D &vec) const
 Vector cross product. More...
 
void setX (double newX)
 Sets X component. More...
 
void setY (double newY)
 Sets Y component. More...
 
void setZ (double newZ)
 Sets new Z component. More...
 
double getX () const
 Returns the X component. More...
 
double getY () const
 Returns the Y component. More...
 
double getZ () const
 Retusn the Z component. More...
 
double getAngleX () const
 Returns the angle to the X axis. More...
 
double getAngleY () const
 Returns the angle to the Y axis. More...
 
double getAngleZ () const
 Returns the angle to the Z axis. More...
 
Matrix toMatrix () const
 Converts this vector to a 3x1 matrix. More...
 
void setMatrix (Matrix mat)
 Sets the components of this vector based on a 3x1 matrix. More...
 

Protected Attributes

double xComp
 
double yComp
 
double zComp
 

Constructor & Destructor Documentation

ADBLib::Vector3D::Vector3D ( )

Constructor. Sets y and z to 0, and x to 1.

ADBLib::Vector3D::Vector3D ( double  newX,
double  newY,
double  newZ 
)

Constructor. Lets you set initial component values.

Parameters
newXX component
newYY component
newZZ component

Member Function Documentation

double ADBLib::Vector3D::getADelt ( Vector3D  vec) const

Gets the angle between two vectors.

Parameters
vecThe second vector.
Returns
Angle in radians.

Here is the call graph for this function:

double ADBLib::Vector3D::getAngleX ( ) const

Returns the angle to the X axis.

Returns
Angle in radians
double ADBLib::Vector3D::getAngleY ( ) const

Returns the angle to the Y axis.

Returns
Angle in radians
double ADBLib::Vector3D::getAngleZ ( ) const

Returns the angle to the Z axis.

Returns
Angle in radians
double ADBLib::Vector3D::getX ( ) const

Returns the X component.

Returns
X component
double ADBLib::Vector3D::getY ( ) const

Returns the Y component.

Returns
Y component
double ADBLib::Vector3D::getZ ( ) const

Retusn the Z component.

Returns
Z component
double ADBLib::Vector3D::mag ( ) const

Returns the magnitude of the vector.

Returns
Magnitude

Here is the caller graph for this function:

void ADBLib::Vector3D::normalize ( )

Normalizes the vector, preserving the direction but setting magnitude to 1.

Vector3D ADBLib::Vector3D::operator% ( const Vector3D vec) const

Vector cross product.

Returns
Resulting vector of vector cross product.
double ADBLib::Vector3D::operator* ( const Vector3D vec) const

Vector dot product.

Returns
Dot product result.
Vector3D ADBLib::Vector3D::operator* ( const double &  num) const
Vector3D ADBLib::Vector3D::operator+ ( const Vector3D vec) const

Standard vector addition.

Vector3D ADBLib::Vector3D::operator- ( const Vector3D vec) const

Standard vector subtraction.

void ADBLib::Vector3D::rotateX ( double  rad)

Rotates the vector about the X axis.

Parameters
radAngle of rotation in radians.

Here is the call graph for this function:

void ADBLib::Vector3D::rotateY ( double  rad)

Rotates the vector about the Y axis.

Parameters
radAngle of rotation in radians.

Here is the call graph for this function:

void ADBLib::Vector3D::rotateZ ( double  rad)

Rotates the vector about the Z axis.

Parameters
radAngle of rotation in radians.

Here is the call graph for this function:

void ADBLib::Vector3D::setMag ( double  newMag)

Sets the magnitude of the vector.

Parameters
newMagNew magnitude.
void ADBLib::Vector3D::setMatrix ( Matrix  mat)

Sets the components of this vector based on a 3x1 matrix.

Parameters
matA 3x1 matrix of vector components in order x,y,z
Todo:
Flip matrix to 1x3 (XxY)

Here is the call graph for this function:

void ADBLib::Vector3D::setX ( double  newX)

Sets X component.

Parameters
newXNew X component
void ADBLib::Vector3D::setY ( double  newY)

Sets Y component.

Parameters
newYNew Y component.
void ADBLib::Vector3D::setZ ( double  newZ)

Sets new Z component.

Parameters
newZNew Z component.
Matrix ADBLib::Vector3D::toMatrix ( ) const

Converts this vector to a 3x1 matrix.

Returns
A 3x1 matrix of the vector components in order x,y,z
Todo:
Flip matrix to 1x3 (XxY)

Here is the call graph for this function:

Member Data Documentation

double ADBLib::Vector3D::xComp
protected
double ADBLib::Vector3D::yComp
protected
double ADBLib::Vector3D::zComp
protected

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