//
// add the translation to this matrix
+// | 1 0 0 | | m_11 m_12 0 |
+// | 0 1 0 | x | m_21 m_22 0 |
+// | dx dy 1 | | m_tx m_ty 1 |
void wxAffineMatrix2D::Translate(wxDouble dx, wxDouble dy)
{
- m_tx += dx;
- m_ty += dy;
+ m_tx += m_11 * dx + m_21 * dy;
+ m_ty += m_12 * dx + m_22 * dy;
}
// add the scale to this matrix
m_22 *= yScale;
}
-// add the rotation to this matrix (counter clockwise, radians)
-// | cos -sin 0 | | m_11 m_12 0 |
-// | sin cos 0 | x | m_21 m_22 0 |
+// add the rotation to this matrix (clockwise, radians)
+// | cos sin 0 | | m_11 m_12 0 |
+// | -sin cos 0 | x | m_21 m_22 0 |
// | 0 0 1 | | m_tx m_ty 1 |
-void wxAffineMatrix2D::Rotate(wxDouble ccRadians)
+void wxAffineMatrix2D::Rotate(wxDouble cRadians)
{
- wxDouble c = cos(ccRadians);
- wxDouble s = sin(ccRadians);
+ wxDouble c = cos(cRadians);
+ wxDouble s = sin(cRadians);
- wxDouble e11 = c*m_11 - s*m_21;
- wxDouble e12 = c*m_12 - s*m_22;
- m_21 = s*m_11 + c*m_21;
- m_22 = s*m_12 + c*m_22;
+ wxDouble e11 = c*m_11 + s*m_21;
+ wxDouble e12 = c*m_12 + s*m_22;
+ m_21 = c*m_21 - s*m_11;
+ m_22 = c*m_22 - s*m_12;
m_11 = e11;
m_12 = e12;
}
return src;
return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21 + m_tx,
- src.m_y * m_12 + src.m_y * m_22 + m_ty);
+ src.m_x * m_12 + src.m_y * m_22 + m_ty);
}
// applies the matrix except for translations
return src;
return wxPoint2DDouble(src.m_x * m_11 + src.m_y * m_21,
- src.m_y * m_12 + src.m_y * m_22);
+ src.m_x * m_12 + src.m_y * m_22);
}
bool wxAffineMatrix2D::IsIdentity() const