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 Vector4;
22 Vector3(
const Vector3<T>& other) =
default;
23 Vector3(Vector3<T>&& other) noexcept =
default;
26 double DotProduct(
const Vector3<T>& other)
const;
29 Vector3<double>
CrossProduct(
const Vector3<T>& other)
const;
38 [[nodiscard]] Vector3<double>
Normalize()
const;
44 [[nodiscard]] Vector3<T>
VectorScale(
const Vector3<T>& scalar)
const;
47 void LerpSelf(
const Vector3<T>& other,
double t);
50 [[nodiscard]] Vector3<double>
Lerp(
const Vector3<T>& other,
double t)
const;
53 [[nodiscard]]
bool Similar(
const Vector3<T>& other,
double epsilon = 0.00001)
const;
56 [[nodiscard]] Vector3<int>
ToInt()
const;
59 [[nodiscard]] Vector3<double>
ToDouble()
const;
64 Vector3<T>
operator+(
const Vector3<T>& other)
const;
66 Vector3<T>
operator-(
const Vector3<T>& other)
const;
68 Vector3<T>
operator*(
const T scale)
const;
70 Vector3<T>
operator/(
const T scale)
const;
72 Vector3<T>
operator*(
const Matrix4x4& mat)
const;
76 operator Vector2<T>()
const;
77 operator Vector4<T>()
const;
80 void operator=(Vector3<T>&& other) noexcept;
82 bool operator==(
const Vector3<T>& other)
const;
83 bool operator!=(
const Vector3<T>& other)
const;
87 return os <<
"[x: " << v.x <<
" y: " << v.y <<
" z: " << v.z <<
"]";
91 return os << L
"[x: " << v.x << L
" y: " << v.y << L
" z: " << v.z << L
"]";
Vector3< T > operator+(const Vector3< T > &other) const
static const Vector3< double > right
friend std::ostream & operator<<(std::ostream &os, const Vector3< T > &v)
void LerpSelf(const Vector3< T > &other, double t)
Will lerp itself towards other by t.
Vector3< double > CrossProduct(const Vector3< T > &other) const
Will compute the cross product to another Vector3.
static const Vector3< double > left
bool Similar(const Vector3< T > &other, double epsilon=0.00001) const
Will compare if two vectors are similar to a certain epsilon value.
Representation of a 3d vector.
Vector3(T _x, T _y, T _z)
Vector3< T > operator-() const
static const Vector3< double > down
Vector3< double > Lerp(const Vector3< T > &other, double t) const
Will return a lerp result between this and another vector.
static const Vector3< double > forward
static const Vector3< double > one
void operator=(const Vector3< T > &other)
Conversion method.
Vector3< double > ToDouble() const
Will convert this vector to a Vector3d.
Vector3< int > ToInt() const
Will convert this vector to a Vector3i.
bool operator==(const Vector3< T > &other) const
void operator*=(const T scale)
Vector3< double > Vector3d
static const Vector3< double > backward
Vector3< double > Normalize() const
Will return the normalization of this vector.
static const Vector3< double > up
T & operator[](std::size_t idx)
double DotProduct(const Vector3< T > &other) const
Will compute the dot product to another Vector3.
Vector3< T > operator/(const T scale) const
void operator-=(const Vector3< T > &other)
double SqrMagnitude() const
Will compute the square magnitude.
void operator/=(const T scale)
bool operator!=(const Vector3< T > &other) const
void operator+=(const Vector3< T > &other)
double Magnitude() const
Will compute the magnitude.
void NormalizeSelf()
Will normalize this vector.
Vector3< T > operator*(const T scale) const
static const Vector3< double > zero
Vector3< T > VectorScale(const Vector3< T > &scalar) const
Will scale self.n by scalar.n.