Implement Transform methods
This commit is contained in:
@@ -100,10 +100,8 @@ namespace LinearAlgebra {
|
|||||||
|
|
||||||
// Transforms the given vectors by this matrix M, i.e. returns M * (x,y,z)
|
// 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;
|
Vector3 Transform(const Vector3& rhs) const;
|
||||||
Vector2 Transform(float x, float y) const;
|
|
||||||
Vector3 Transform(float x, float y, float z) const;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -156,7 +156,22 @@ namespace LinearAlgebra {
|
|||||||
m00, m10, m20,
|
m00, m10, m20,
|
||||||
m01, m11, m21,
|
m01, m11, m21,
|
||||||
m02, m12, m22
|
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
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user