120 std::vector<T>
vec()
const {
121 return {
static_cast<T
>(x),
static_cast<T
>(y),
static_cast<T
>(z)};
a simple class used for vector math, most function are self explanatory
Definition: vector3.h:12
Vector3()
Default constructor.
Vector3 & normalize()
Normalizes the Vector3 object.
Vector3 unit() const
Normalizes the vector in the same direction.
bool operator==(const Vector3 &v) const
Overrides comparison operator.
Vector3 operator*(double s) const
Overrides * operator.
Vector3(double a, double b, double c)
Parameter constructor.
double operator*(const Vector3 &v) const
Dot product.
Vector3 operator+(const Vector3 &v) const
Overrides + operator.
double magnitude() const
Returns the magnitude of the Vector3 object.
std::vector< T > vec() const
return std::vector version of this Vector3 template function should be defined in same file with temp...
Definition: vector3.h:120
double & operator[](int i)
Overrides indexing operator.
Vector3 operator/(double s) const
Overrides / operator.
double operator[](int i) const
Overrides const indexing operator.
double dist(const Vector3 &v) const
Finds the distance between two vectors.
Vector3 operator-(const Vector3 &v) const
Overrides - operator.
Vector3(const std::vector< float > &v)
Parameter constructor.
friend std::ostream & operator<<(std::ostream &strm, const Vector3 &v)
<< operator for Vector3 objects
Vector3(double a)
Parameter constructor.
Vector3 cross(const Vector3 &v) const
Cross product.
Vector3(const std::vector< double > &v)
Parameter constructor.