/********************\ | Copyright 2024, | | Ulysse Cura | \********************/ ///////////////////////////////////////// // // // Definition de la classe Vector2D. // // // ///////////////////////////////////////// template Vector2D::Vector2D() : x(static_cast(0)), y(static_cast(0)) {} template Vector2D::Vector2D(T xInit, T yInit) : x(xInit), y(yInit) {} template template Vector2D::Vector2D(const Vector2D& vec) : x(static_cast(vec.x)), y(static_cast(vec.y)) {} template Vector2D &Vector2D::operator+=(const Vector2D &vec) noexcept { x += vec.x; y += vec.y; return *this; } template Vector2D &Vector2D::operator-=(const Vector2D &vec) noexcept { x -= vec.x; y -= vec.y; return *this; } template Vector2D &Vector2D::operator*=(const Vector2D &vec) noexcept { x *= vec.x; y *= vec.y; return *this; } template Vector2D &Vector2D::operator/=(const Vector2D &vec) noexcept { x /= vec.x; y /= vec.y; return *this; } template Vector2D Vector2D::operator*(const T &i) noexcept { return Vector2D(x * i, y * i); } template Vector2D Vector2D::operator/(const T &i) noexcept { return Vector2D(x / i, y / i); } template Vector2D &Vector2D::zero() noexcept { x = static_cast(0); y = static_cast(0); return *this; } template Vector2D operator+(const Vector2D &v1, const Vector2D &v2) { return Vector2D(v1.x + v2.x, v1.y + v2.y); } template Vector2D operator-(const Vector2D &v1, const Vector2D &v2) { return Vector2D(v1.x - v2.x, v1.y - v2.y); } template Vector2D operator*(const Vector2D &v1, const Vector2D &v2) { return Vector2D(v1.x * v2.x, v1.y * v2.y); } template Vector2D operator/(const Vector2D &v1, const Vector2D &v2) { return Vector2D(v1.x / v2.x, v1.y / v2.y); }