Leonetienne/Eule
Homemade math library, mainly targetted towards computer graphics
|
Go to the documentation of this file.
7 template <
typename T>
class Vector3;
19 Vector2(
const Vector2<T>& other) =
default;
20 Vector2(Vector2<T>&& other) noexcept =
default;
23 double DotProduct(
const Vector2<T>& other)
const;
35 [[nodiscard]] Vector2<double>
Normalize()
const;
41 Vector2<T>
VectorScale(
const Vector2<T>& scalar)
const;
44 void LerpSelf(
const Vector2<T>& other,
double t);
47 [[nodiscard]] Vector2<double>
Lerp(
const Vector2<T>& other,
double t)
const;
50 [[nodiscard]]
bool Similar(
const Vector2<T>& other,
double epsilon = 0.00001)
const;
53 [[nodiscard]] Vector2<int>
ToInt()
const;
56 [[nodiscard]] Vector2<double>
ToDouble()
const;
61 Vector2<T>
operator+(
const Vector2<T>& other)
const;
63 Vector2<T>
operator-(
const Vector2<T>& other)
const;
65 Vector2<T>
operator*(
const T scale)
const;
67 Vector2<T>
operator/(
const T scale)
const;
71 operator Vector3<T>()
const;
72 operator Vector4<T>()
const;
75 void operator=(Vector2<T>&& other) noexcept;
77 bool operator==(
const Vector2<T>& other)
const;
78 bool operator!=(
const Vector2<T>& other)
const;
82 return os <<
"[x: " << v.
x <<
" y: " << v.
y <<
"]";
86 return os << L
"[x: " << v.
x << L
" y: " << v.
y << L
"]";
Vector2< double > Normalize() const
Will return the normalization of this vector.
bool operator!=(const Vector2< T > &other) const
Vector2< T > operator+(const Vector2< T > &other) const
void operator+=(const Vector2< T > &other)
double DotProduct(const Vector2< T > &other) const
Will compute the dot product to another Vector2.
static const Vector2< double > left
static const Vector2< double > up
double Magnitude() const
Will compute the magnitude.
void operator*=(const T scale)
Vector2< T > operator/(const T scale) const
static const Vector2< double > zero
Vector2< T > VectorScale(const Vector2< T > &scalar) const
Will scale self.n by scalar.n.
Vector2< int > ToInt() const
Will convert this vector to a Vector2i.
T & operator[](std::size_t idx)
static const Vector2< double > one
Vector2< T > operator*(const T scale) const
void operator/=(const T scale)
double SqrMagnitude() const
Will compute the square magnitude.
Vector2< double > Lerp(const Vector2< T > &other, double t) const
Will return a lerp result between this and another vector.
double CrossProduct(const Vector2< T > &other) const
Will compute the cross product to another Vector2.
Vector2< double > ToDouble() const
Will convert this vector to a Vector2d.
void NormalizeSelf()
Will normalize this vector.
Vector2< T > operator-() const
friend std::ostream & operator<<(std::ostream &os, const Vector2< T > &v)
Representation of a 2d vector.
Vector2< double > Vector2d
void operator=(const Vector2< T > &other)
Conversion method.
bool Similar(const Vector2< T > &other, double epsilon=0.00001) const
Will compare if two vectors are similar to a certain epsilon value.
static const Vector2< double > right
void operator-=(const Vector2< T > &other)
static const Vector2< double > down
bool operator==(const Vector2< T > &other) const
void LerpSelf(const Vector2< T > &other, double t)
Will lerp itself towards other by t.
Representation of a 4d vector.