5#ifndef SAPPHIRE_MATHS_VECTOR2_GUARD
6#define SAPPHIRE_MATHS_VECTOR2_GUARD
86 constexpr Vec2(T _x, T _y)
noexcept;
93 constexpr Vec2(T _scale)
noexcept;
109 template <
typename TIn>
119 template <
typename TIn>
141 constexpr
bool Equals(const
Vec2& _other, T _epsilon = std::numeric_limits<T>::epsilon()) const noexcept;
151 constexpr
bool operator==(const
Vec2 & _rhs) const noexcept;
160 constexpr
bool operator!=(const
Vec2 & _rhs) const noexcept;
178 const T*
Data() const noexcept;
188 T& operator[](uint32_t _index);
197 const T& operator[](uint32_t _index) const;
298 static constexpr T
Dot(const
Vec2& _lhs, const
Vec2& _rhs) noexcept;
459 constexpr
Vec2 operator-() const noexcept;
468 constexpr
Vec2 operator*(T _scale) const noexcept;
477 Vec2 operator/(T _scale) const;
486 constexpr
Vec2 operator+(const
Vec2& _rhs) const noexcept;
495 constexpr
Vec2 operator-(const
Vec2& _rhs) const noexcept;
504 constexpr
Vec2 operator*(const
Vec2& _rhs) const noexcept;
522 constexpr T operator|(const
Vec2& _rhs) const noexcept;
531 constexpr T operator^(const
Vec2& _rhs) const noexcept;
541 Vec2& operator*=(T _scale) noexcept;
600 template <typename T>
601 constexpr
Vec2<T> operator*(typename std::remove_cv<T>::type _lhs, const
Vec2<T>& _rhs) noexcept;
611 template <typename T>
612 Vec2<T> operator/(typename std::remove_cv<T>::type _lhs, const
Vec2<T>& _rhs);
628 template <
typename T>
629 std::string ToString(
const Vec2<T>& _v);
650 template <
typename T>
676#include <SA/Maths/Space/Vector2.inl>
Cosinus method implementation.
Maths module Debug compatibility definition.
Degree type implementation.
Equals method implementation.
Lerp algorithms implementation.
Square Root algorithm implementation.
Tangent method implementation.
Maths Degree type.
Definition Degree.hpp:37
Vector 2 Sapphire's class.
Definition Vector2.hpp:41
Vec2 Reflect(const Vec2 &_normal, float _elasticity=1.0f) const noexcept
Reflect this vector over the normal.
static constexpr T Dist(const Vec2 &_start, const Vec2 &_end)
Compute the Distance between _start and _end.
static Deg< T > AngleUnsigned(const Vec2 &_start, const Vec2 &_end) noexcept
Compute the Unsigned Angle between _start and _end.
Vec2(Vec2 &&)=default
Default move constructor.
constexpr Vec2(const Vec2< TIn > &_other) noexcept
Value constructor from another Vec2 type.
static const Vec2 Left
Left vector constant { -1, 0 }.
Definition Vector2.hpp:64
Vec2 ProjectOnToNormal(const Vec2 &_normal) const noexcept
Project this vector onto s normal.
static const Vec2 Up
Up vector constant { 0, 1 }.
Definition Vector2.hpp:67
T Type
Scalar type of the Vector.
Definition Vector2.hpp:43
Vec2 & Normalize()
Normalize this vector.
constexpr Vec2(const Vec3< TIn > &_other) noexcept
Value constructor from Vec3.
static constexpr T Cross(const Vec2 &_lhs, const Vec2 &_rhs) noexcept
Compute the Cross product between _lhs and _rhs.
static Vec2 Lerp(const Vec2 &_start, const Vec2 &_end, float _alpha) noexcept
Clamped Lerp from _start to _end at _alpha.
static const Vec2 Right
Right vector constant { 1, 0 }.
Definition Vector2.hpp:61
T * Data() noexcept
Getter of vector data
constexpr bool IsZero() const noexcept
Whether this vector is a zero vector.
constexpr bool Equals(const Vec2 &_other, T _epsilon=std::numeric_limits< T >::epsilon()) const noexcept
Compare 2 vector.
constexpr T SqrLength() const noexcept
Getter of the Squared Length of this vector.
Vec2()=default
Default constructor.
static const Vec2 Down
Down vector constant { 0, -1 }.
Definition Vector2.hpp:70
constexpr Vec2(T _scale) noexcept
Scale Value constructor.
Vec2 ProjectOnTo(const Vec2 &_other) const noexcept
Project this vector onto an other vector.
constexpr Vec2(T _x, T _y) noexcept
Value constructor.
Vec2 GetNormalized() const
Normalize this vector.
Vec2 Perpendicular() const noexcept
Compute the perpendicular vector to this vector.
static Deg< T > Angle(const Vec2 &_start, const Vec2 &_end) noexcept
Compute the Signed Angle between _start and _end.
static constexpr Vec2 Dir(const Vec2 &_start, const Vec2 &_end) noexcept
Compute the Non-Normalized Direction from _start to _end.
static Vec2 SLerpUnclamped(const Vec2 &_start, const Vec2 &_end, float _alpha) noexcept
Unclamped SLerp from _start to _end at _alpha.
static const Vec2 One
One vector constant { 1, 1 }.
Definition Vector2.hpp:58
static const Vec2 Zero
Zero vector constant { 0, 0 }.
Definition Vector2.hpp:55
static Vec2 SLerp(const Vec2 &_start, const Vec2 &_end, float _alpha) noexcept
Clamped SLerp from _start to _end at _alpha.
static Vec2 LerpUnclamped(const Vec2 &_start, const Vec2 &_end, float _alpha) noexcept
Unclamped Lerp from _start to _end at _alpha.
static constexpr T SqrDist(const Vec2 &_start, const Vec2 &_end) noexcept
Compute the Squared Distance between _start and _end.
Vec2(const Vec2 &)=default
Default copy constructor.
static constexpr Vec2 DirN(const Vec2 &_start, const Vec2 &_end)
Compute the Normalized Direction from _start to _end.
constexpr T Length() const
Getter of the /b length of this vector.
constexpr bool IsNormalized() const noexcept
Whether this vector is normalized.
static constexpr T Dot(const Vec2 &_lhs, const Vec2 &_rhs) noexcept
Compute the Dot product between _lhs and _rhs.
T y
Vector's Y component (axis value).
Definition Vector2.hpp:50
T x
Vector's X component (axis value).
Definition Vector2.hpp:47
Vector 3 Sapphire-Maths class.
Definition Vector3.hpp:43