diff --git a/include/J3ML/LinearAlgebra/Matrix3x3.h b/include/J3ML/LinearAlgebra/Matrix3x3.h index 0d748e3..0387389 100644 --- a/include/J3ML/LinearAlgebra/Matrix3x3.h +++ b/include/J3ML/LinearAlgebra/Matrix3x3.h @@ -100,10 +100,8 @@ namespace LinearAlgebra { // Transforms the given vectors by this matrix M, i.e. returns M * (x,y,z) - Vector2 Transform(const Vector2& vector) const; + Vector2 Transform(const Vector2& rhs) const; Vector3 Transform(const Vector3& rhs) const; - Vector2 Transform(float x, float y) const; - Vector3 Transform(float x, float y, float z) const; diff --git a/src/J3ML/LinearAlgebra/Matrix3x3.cpp b/src/J3ML/LinearAlgebra/Matrix3x3.cpp index cf502d6..5502000 100644 --- a/src/J3ML/LinearAlgebra/Matrix3x3.cpp +++ b/src/J3ML/LinearAlgebra/Matrix3x3.cpp @@ -156,7 +156,22 @@ namespace LinearAlgebra { m00, m10, m20, m01, m11, m21, m02, m12, m22 - } + }; + } + + Vector2 Matrix3x3::Transform(const Vector2 &rhs) const { + return { + At(0,0) * rhs.x + At(0, 1) * rhs.y, + At(1, 0) * rhs.x + At(1, 1) * rhs.y + }; + } + + Vector3 Matrix3x3::Transform(const Vector3 &rhs) const { + return { + At(0, 0) * rhs.x + At(0, 1) * rhs.y + At(0, 2) * rhs.z, + At(1, 0) * rhs.x + At(1, 1) * rhs.y + At(1, 2) * rhs.z, + At(2, 0) * rhs.x + At(2, 1) * rhs.y + At(2, 2) * rhs.z + }; } }