Matrix3x3f Matrix3x3f::IdentityMatrix() { Matrix3x3f identity; identity.SetIdentity(); return identity; }
Matrix3x3f Matrix3x3f::TranslateMatrix(const Vec2f translation) { Matrix3x3f translateMatrix; translateMatrix.SetIdentity(); translateMatrix.Set(2, 0, translation.x); translateMatrix.Set(2, 1, translation.y); return translateMatrix; }
Matrix3x3f Matrix3x3f::ScaleMatrix(const Vec2f &scale) { Matrix3x3f scaleMatrix; scaleMatrix.SetIdentity(); scaleMatrix.Set(0, 0, scale.x); scaleMatrix.Set(1, 1, scale.y); return scaleMatrix; }
Matrix3x3f Matrix3x3f::RotateMatrix(float angle) { float cosOfAngle = cosf(angle); float sinOfAngle = sinf(angle); Matrix3x3f rotationMatrix; rotationMatrix.SetIdentity(); rotationMatrix.Set(0, 0, cosOfAngle); rotationMatrix.Set(1, 0, sinOfAngle); rotationMatrix.Set(0, 1, -sinOfAngle); rotationMatrix.Set(1, 1, cosOfAngle); return rotationMatrix; }