template<class T>
nCine::Vector2 class

Two-component vector.

Public static variables

static const Vector2 Zero
A vector with all zero elements.
static const Vector2 XAxis
A unit vector on the X axis.
static const Vector2 YAxis
A unit vector on the Y axis.

Public static functions

static auto Dot(Vector2 v1, Vector2 v2) -> T
static auto Lerp(Vector2 a, Vector2 b, float t) -> Vector2
static auto FromAngleLength(T angle, T length) -> Vector2

Constructors, destructors, conversion operators

Vector2() constexpr noexcept
Vector2(NoInitT) explicit noexcept
Vector2(T s) explicit constexpr noexcept
Vector2(T x, T y) constexpr noexcept
Vector2(const Vector2& other) constexpr noexcept
Vector2(Vector2&& other) constexpr noexcept

Public functions

auto operator=(const Vector2& other) -> Vector2& noexcept
auto operator=(Vector2&& other) -> Vector2& noexcept
void Set(T x, T y)
auto Data() -> T*
auto Data() const -> const T*
auto operator[](std::size_t index) -> T&
auto operator[](std::size_t index) const -> const T&
auto operator==(const Vector2& v) const -> bool
auto operator!=(const Vector2& v) const -> bool
auto operator-() const -> Vector2
auto operator+=(const Vector2& v) -> Vector2&
auto operator-=(const Vector2& v) -> Vector2&
auto operator*=(const Vector2& v) -> Vector2&
auto operator/=(const Vector2& v) -> Vector2&
auto operator+=(T s) -> Vector2&
auto operator-=(T s) -> Vector2&
auto operator*=(T s) -> Vector2&
auto operator/=(T s) -> Vector2&
auto operator+(const Vector2& v) const -> Vector2
auto operator-(const Vector2& v) const -> Vector2
auto operator*(const Vector2& v) const -> Vector2
auto operator/(const Vector2& v) const -> Vector2
auto operator+(T s) const -> Vector2
auto operator-(T s) const -> Vector2
auto operator*(T s) const -> Vector2
auto operator/(T s) const -> Vector2
auto Length() const -> T
auto SqrLength() const -> T
auto Normalized() const -> Vector2
auto Normalize() -> Vector2&
template<class S>
auto As() -> Vector2<S>
Converts elements of the vector to a specified type.

Public variables

T X
T Y

Friends

template<class S>
auto operator*(S s, const Vector2<S>& v) -> Vector2<S>