diff --git a/include/J3ML/LinearAlgebra/Vector2.h b/include/J3ML/LinearAlgebra/Vector2.h index 9d6d4a3..662bf41 100644 --- a/include/J3ML/LinearAlgebra/Vector2.h +++ b/include/J3ML/LinearAlgebra/Vector2.h @@ -112,16 +112,18 @@ namespace LinearAlgebra { /// Multiplies this vector by a vector, element-wise /// @note Mathematically, the multiplication of two vectors is not defined in linear space structures, /// but this function is provided here for syntactical convenience. - Vector2 Mul(const Vector2& v) const - { - return {this->x*v.x, this->y*v.y}; - } + Vector2 Mul(const Vector2& v) const; /// Divides this vector by a scalar. Vector2 operator /(float rhs) const; Vector2 Div(float scalar) const; static Vector2 Div(const Vector2& lhs, float rhs); + /// Divides this vector by a vector, element-wise + /// @note Mathematically, the multiplication of two vectors is not defined in linear space structures, + /// but this function is provided here for syntactical convenience + Vector2 Div(const Vector2& v) const; + /// Unary operator + Vector2 operator +() const; // TODO: Implement Vector2 operator -() const; diff --git a/src/J3ML/LinearAlgebra/Vector2.cpp b/src/J3ML/LinearAlgebra/Vector2.cpp index c2ae8ca..b24294d 100644 --- a/src/J3ML/LinearAlgebra/Vector2.cpp +++ b/src/J3ML/LinearAlgebra/Vector2.cpp @@ -243,5 +243,9 @@ namespace LinearAlgebra { return std::max(x, y); } + Vector2 Vector2::Mul(const Vector2 &v) const { + return {this->x*v.x, this->y*v.y}; + } + } \ No newline at end of file