CSCI3081W Drone Delivery System
|
a simple class used for vector math, most function are self explanatory More...
#include <vector3.h>
Public Member Functions | |
Vector3 () | |
Default constructor. | |
Vector3 (double a) | |
Parameter constructor. More... | |
Vector3 (double a, double b, double c) | |
Parameter constructor. More... | |
Vector3 (const std::vector< double > &v) | |
Parameter constructor. More... | |
Vector3 (const std::vector< float > &v) | |
Parameter constructor. More... | |
bool | operator== (const Vector3 &v) const |
Overrides comparison operator. More... | |
double & | operator[] (int i) |
Overrides indexing operator. More... | |
double | operator[] (int i) const |
Overrides const indexing operator. More... | |
Vector3 | operator+ (const Vector3 &v) const |
Overrides + operator. More... | |
Vector3 | operator- (const Vector3 &v) const |
Overrides - operator. More... | |
Vector3 | operator* (double s) const |
Overrides * operator. More... | |
Vector3 | operator/ (double s) const |
Overrides / operator. More... | |
double | operator* (const Vector3 &v) const |
Dot product. More... | |
template<class T > | |
std::vector< T > | vec () const |
return std::vector version of this Vector3 template function should be defined in same file with template keyword | |
Vector3 | cross (const Vector3 &v) const |
Cross product. More... | |
double | magnitude () const |
Returns the magnitude of the Vector3 object. | |
Vector3 & | normalize () |
Normalizes the Vector3 object. | |
Vector3 | unit () const |
Normalizes the vector in the same direction. | |
double | dist (const Vector3 &v) const |
Finds the distance between two vectors. More... | |
Public Attributes | |
double | x = 0 |
double | y = 0 |
double | z = 0 |
Friends | |
std::ostream & | operator<< (std::ostream &strm, const Vector3 &v) |
<< operator for Vector3 objects More... | |
a simple class used for vector math, most function are self explanatory
Vector3::Vector3 | ( | double | a | ) |
Parameter constructor.
[in] | a | x, y, and z-coordinate |
Vector3::Vector3 | ( | double | a, |
double | b, | ||
double | c | ||
) |
Parameter constructor.
[in] | a | x-coordinate |
[in] | b | y-coordinate |
[in] | c | z-coordinate |
Vector3::Vector3 | ( | const std::vector< double > & | v | ) |
Parameter constructor.
[in] | v | The vector containing double-value xyz coordinates |
Vector3::Vector3 | ( | const std::vector< float > & | v | ) |
Parameter constructor.
[in] | v | The vector containing float-value xyz coordinates |
double Vector3::dist | ( | const Vector3 & | v | ) | const |
double Vector3::operator* | ( | const Vector3 & | v | ) | const |
Vector3 Vector3::operator* | ( | double | s | ) | const |
Vector3 Vector3::operator/ | ( | double | s | ) | const |
bool Vector3::operator== | ( | const Vector3 & | v | ) | const |
double& Vector3::operator[] | ( | int | i | ) |
Overrides indexing operator.
i | The index you want to return |
double Vector3::operator[] | ( | int | i | ) | const |
Overrides const indexing operator.
i | The index you want to return |
|
friend |