Skip to content

Commit

Permalink
Add overload for Mat3::scale to accept Vec2 parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Nov 27, 2024
1 parent 926d777 commit e5cee5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jngl/Mat3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Mat3& Mat3::scale(const float xfactor, const float yfactor) {
return *this *= boost::qvm::diag_mat(boost::qvm::vec<float, 3>{ { xfactor, yfactor, 1 } });
}

Mat3& Mat3::scale(const Vec2& v) {
return scale(v.x, v.y);
}

Mat3& Mat3::rotate(const float radian) {
boost::qvm::rotate_z(*this, radian);
return *this;
Expand Down
6 changes: 6 additions & 0 deletions src/jngl/Mat3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ class Mat3 {
/// \endcode
Mat3& scale(float xfactor, float yfactor);

/// Multiplies the matrix by a scaling matrix
///
/// Equivalent to calling `Mat3::scale(v.x, v.y)`.
/// \return *this
Mat3& scale(const Vec2& v);

/// Multiplies the matrix with a rotation matrix
///
/// \return *this
Expand Down

0 comments on commit e5cee5c

Please sign in to comment.