Leonetienne/Eule
Homemade math library, mainly targetted towards computer graphics
|
Go to the documentation of this file.
10 template <
typename T>
class Vector2;
11 template <
typename T>
class Vector3;
21 Vector4(T _x, T _y, T _z, T _w) :
x{ _x },
y{ _y },
z{ _z },
w{ _w } {}
22 Vector4(
const Vector4<T>& other) =
default;
23 Vector4(Vector4<T>&& other) noexcept =
default;
32 [[nodiscard]] Vector4<double>
Normalize()
const;
38 [[nodiscard]] Vector4<T>
VectorScale(
const Vector4<T>& scalar)
const;
41 void LerpSelf(
const Vector4<T>& other,
double t);
44 [[nodiscard]] Vector4<double>
Lerp(
const Vector4<T>& other,
double t)
const;
47 [[nodiscard]]
bool Similar(
const Vector4<T>& other,
double epsilon = 0.00001)
const;
50 [[nodiscard]] Vector4<int>
ToInt()
const;
53 [[nodiscard]] Vector4<double>
ToDouble()
const;
58 Vector4<T>
operator+(
const Vector4<T>& other)
const;
60 Vector4<T>
operator-(
const Vector4<T>& other)
const;
62 Vector4<T>
operator*(
const T scale)
const;
64 Vector4<T>
operator/(
const T scale)
const;
66 Vector4<T>
operator*(
const Matrix4x4& mat)
const;
70 operator Vector2<T>()
const;
71 operator Vector3<T>()
const;
74 void operator=(Vector4<T>&& other) noexcept;
76 bool operator==(
const Vector4<T>& other)
const;
77 bool operator!=(
const Vector4<T>& other)
const;
81 return os <<
"[x: " << v.x <<
" y: " << v.y <<
" z: " << v.z <<
" w: " << v.w <<
"]";
85 return os << L
"[x: " << v.x << L
" y: " << v.y << L
" z: " << v.z << L
" w: " << v.w << L
"]";
Vector4< int > ToInt() const
Will convert this vector to a Vector4i.
Vector4(T _x, T _y, T _z, T _w)
void operator+=(const Vector4< T > &other)
Vector4< T > operator/(const T scale) const
Vector4< T > operator*(const T scale) const
void NormalizeSelf()
Will normalize this vector.
static const Vector4< double > backward
void operator=(const Vector4< T > &other)
Conversion method.
void operator-=(const Vector4< T > &other)
Vector4< double > Normalize() const
Will return the normalization of this vector.
void operator*=(const T scale)
Vector4< double > Vector4d
Vector4< T > VectorScale(const Vector4< T > &scalar) const
Will scale self.n by scalar.n.
Vector4< T > operator-() const
Vector4< double > Lerp(const Vector4< T > &other, double t) const
Will return a lerp result between this and another vector.
static const Vector4< double > one
void LerpSelf(const Vector4< T > &other, double t)
Will lerp itself towards other by t.
static const Vector4< double > forward
void operator/=(const T scale)
static const Vector4< double > down
Vector4< T > operator+(const Vector4< T > &other) const
T & operator[](std::size_t idx)
Vector4< double > ToDouble() const
Will convert this vector to a Vector4d.
bool operator!=(const Vector4< T > &other) const
bool Similar(const Vector4< T > &other, double epsilon=0.00001) const
Will compare if two vectors are similar to a certain epsilon value.
double Magnitude() const
Will compute the magnitude.
static const Vector4< double > future
bool operator==(const Vector4< T > &other) const
static const Vector4< double > zero
double SqrMagnitude() const
Will compute the square magnitude.
static const Vector4< double > up
static const Vector4< double > past
friend std::ostream & operator<<(std::ostream &os, const Vector4< T > &v)
static const Vector4< double > left
static const Vector4< double > right
Representation of a 4d vector.