Math/Transform.cpp: use transform/scale/ratation functions from Math.h
This commit is contained in:
parent
a6e6b915e6
commit
a4a691fd48
1 changed files with 6 additions and 20 deletions
|
|
@ -52,11 +52,8 @@ Vector2f Transform::getRightVector() const
|
|||
|
||||
Transform& Transform::translate(float x, float y)
|
||||
{
|
||||
Transform t(1, 0, x,
|
||||
0, 1, y,
|
||||
0, 0, 1);
|
||||
|
||||
return combine(t);
|
||||
m_matrix *= math::translate(x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Transform& Transform::translate(Vector2f vec)
|
||||
|
|
@ -66,25 +63,14 @@ Transform& Transform::translate(Vector2f vec)
|
|||
|
||||
Transform& Transform::rotate(float theta)
|
||||
{
|
||||
float a = math::deg2rad(theta);
|
||||
float c = std::cos(a);
|
||||
float s = std::sin(a);
|
||||
|
||||
// Always rotate along z-axis in 2D.
|
||||
Transform r(c, -s, 0,
|
||||
s, c, 0,
|
||||
0, 0, 1);
|
||||
|
||||
return combine(r);
|
||||
m_matrix *= math::rotation(theta);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Transform& Transform::scale(float x, float y)
|
||||
{
|
||||
Transform s(x, 0, 0,
|
||||
0, y, 0,
|
||||
0, 0, 1);
|
||||
|
||||
return combine(s);
|
||||
m_matrix *= math::scale(x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Transform& Transform::scale(Vector2f vec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue