Leonetienne/Eule
Homemade math library, mainly targetted towards computer graphics
|
Representation of a 2d vector. More...
#include <Vector2.h>
Public Member Functions | |
Vector2 () | |
Vector2 (T _x, T _y) | |
Vector2 (const Vector2< T > &other)=default | |
Vector2 (Vector2< T > &&other) noexcept=default | |
double | DotProduct (const Vector2< T > &other) const |
Will compute the dot product to another Vector2. More... | |
double | CrossProduct (const Vector2< T > &other) const |
Will compute the cross product to another Vector2. More... | |
double | SqrMagnitude () const |
Will compute the square magnitude. More... | |
double | Magnitude () const |
Will compute the magnitude. More... | |
Vector2< double > | Normalize () const |
Will return the normalization of this vector. More... | |
void | NormalizeSelf () |
Will normalize this vector. More... | |
Vector2< T > | VectorScale (const Vector2< T > &scalar) const |
Will scale self.n by scalar.n. More... | |
void | LerpSelf (const Vector2< T > &other, double t) |
Will lerp itself towards other by t. More... | |
Vector2< double > | Lerp (const Vector2< T > &other, double t) const |
Will return a lerp result between this and another vector. More... | |
bool | Similar (const Vector2< T > &other, double epsilon=0.00001) const |
Will compare if two vectors are similar to a certain epsilon value. More... | |
Vector2< int > | ToInt () const |
Will convert this vector to a Vector2i. More... | |
Vector2< double > | ToDouble () const |
Will convert this vector to a Vector2d. More... | |
T & | operator[] (std::size_t idx) |
const T & | operator[] (std::size_t idx) const |
Vector2< T > | operator+ (const Vector2< T > &other) const |
void | operator+= (const Vector2< T > &other) |
Vector2< T > | operator- (const Vector2< T > &other) const |
void | operator-= (const Vector2< T > &other) |
Vector2< T > | operator* (const T scale) const |
void | operator*= (const T scale) |
Vector2< T > | operator/ (const T scale) const |
void | operator/= (const T scale) |
Vector2< T > | operator- () const |
operator Vector3< T > () const | |
operator Vector4< T > () const | |
Conversion method. More... | |
void | operator= (const Vector2< T > &other) |
Conversion method. More... | |
void | operator= (Vector2< T > &&other) noexcept |
bool | operator== (const Vector2< T > &other) const |
bool | operator!= (const Vector2< T > &other) const |
Public Attributes | |
T | x |
T | y |
Static Public Attributes | |
static const Vector2< double > | up |
static const Vector2< double > | down |
static const Vector2< double > | right |
static const Vector2< double > | left |
static const Vector2< double > | one |
static const Vector2< double > | zero |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Vector2< T > &v) |
std::wostream & | operator<< (std::wostream &os, const Vector2< T > &v) |
Representation of a 2d vector.
Contains a lot of utility methods.
|
inline |
|
inline |
|
default |
|
defaultnoexcept |
double Vector2::CrossProduct | ( | const Vector2< T > & | other | ) | const |
double Vector2::DotProduct | ( | const Vector2< T > & | other | ) | const |
Vector2< double > Vector2::Lerp | ( | const Vector2< T > & | other, |
double | t | ||
) | const |
Will return a lerp result between this and another vector.
Definition at line 256 of file Vector2.cpp.
void Vector2::LerpSelf | ( | const Vector2< T > & | other, |
double | t | ||
) |
double Vector2::Magnitude |
Will compute the magnitude.
Definition at line 90 of file Vector2.cpp.
Vector2< double > Vector2::Normalize |
Will return the normalization of this vector.
Definition at line 137 of file Vector2.cpp.
void Vector2::NormalizeSelf | ( | ) |
Will normalize this vector.
Definition at line 187 of file Vector2.cpp.
Vector2::operator Vector3< T > |
Definition at line 674 of file Vector2.cpp.
Vector2::operator Vector4< T > |
Conversion method.
Definition at line 680 of file Vector2.cpp.
bool Vector2::operator!= | ( | const Vector2< T > & | other | ) | const |
Definition at line 656 of file Vector2.cpp.
Vector2< T > Vector2::operator* | ( | const T | scale | ) | const |
Definition at line 503 of file Vector2.cpp.
void Vector2::operator*= | ( | const T | scale | ) |
Definition at line 542 of file Vector2.cpp.
Definition at line 346 of file Vector2.cpp.
void Vector2::operator+= | ( | const Vector2< T > & | other | ) |
Vector2< T > Vector2::operator- |
Definition at line 662 of file Vector2.cpp.
Definition at line 424 of file Vector2.cpp.
void Vector2::operator-= | ( | const Vector2< T > & | other | ) |
Vector2< T > Vector2::operator/ | ( | const T | scale | ) | const |
Definition at line 582 of file Vector2.cpp.
void Vector2::operator/= | ( | const T | scale | ) |
Definition at line 620 of file Vector2.cpp.
void Vector2::operator= | ( | const Vector2< T > & | other | ) |
|
noexcept |
bool Vector2::operator== | ( | const Vector2< T > & | other | ) | const |
T & Vector2::operator[] | ( | std::size_t | idx | ) |
Definition at line 267 of file Vector2.cpp.
const T & Vector2::operator[] | ( | std::size_t | idx | ) | const |
Definition at line 281 of file Vector2.cpp.
bool Vector2::Similar | ( | const Vector2< T > & | other, |
double | epsilon = 0.00001 |
||
) | const |
Will compare if two vectors are similar to a certain epsilon value.
Definition at line 295 of file Vector2.cpp.
double Vector2::SqrMagnitude | ( | ) | const |
Vector2< double > Vector2::ToDouble |
Will convert this vector to a Vector2d.
Definition at line 310 of file Vector2.cpp.
Vector2< int > Vector2::ToInt |
Will convert this vector to a Vector2i.
Definition at line 304 of file Vector2.cpp.
Will scale self.n by scalar.n.
Definition at line 127 of file Vector2.cpp.
|
friend |
|
friend |
|
static |
|
static |
|
static |
|
static |
|
static |
T Eule::Vector2< T >::x |
T Eule::Vector2< T >::y |
|
static |