+wxTransformMatrix wxTransformMatrix::operator+(const wxTransformMatrix& m) const
+{
+ wxTransformMatrix result = *this;
+ result += m;
+ result.m_isIdentity = result.IsIdentity1();
+ return result;
+}
+
+wxTransformMatrix wxTransformMatrix::operator-(const wxTransformMatrix& m) const
+{
+ wxTransformMatrix result = *this;
+ result -= m;
+ result.m_isIdentity = result.IsIdentity1();
+ return result;
+}
+
+
+wxTransformMatrix wxTransformMatrix::operator*(const wxTransformMatrix& m) const
+{
+ wxTransformMatrix result = *this;
+ result *= m;
+ result.m_isIdentity = result.IsIdentity1();
+ return result;
+}
+
+
+wxTransformMatrix wxTransformMatrix::operator-() const
+{
+ wxTransformMatrix result = *this;
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++)
+ result.m_matrix[i][j] = -(this->m_matrix[i][j]);
+ result.m_isIdentity = result.IsIdentity1();
+ return result;
+}
+
+static double CheckInt(double getal)
+{
+ // check if the number is very close to an integer
+ if ( (ceil(getal) - getal) < 0.0001)
+ return ceil(getal);
+
+ else if ( (getal - floor(getal)) < 0.0001)
+ return floor(getal);
+
+ return getal;
+
+}
+
+double wxTransformMatrix::Get_scaleX()
+{
+ double scale_factor;
+ double rot_angle = CheckInt(atan2(m_matrix[1][0],m_matrix[0][0])*180/pi);
+ if ( !wxIsSameDouble(rot_angle, 90) && !wxIsSameDouble(rot_angle, -90) )
+ scale_factor = m_matrix[0][0]/cos((rot_angle/180)*pi);
+ else
+ scale_factor = m_matrix[0][0]/sin((rot_angle/180)*pi); // er kan nl. niet door 0 gedeeld worden !
+
+ scale_factor = CheckInt(scale_factor);
+ if (scale_factor < 0)
+ scale_factor = -scale_factor;
+
+ return scale_factor;
+}
+
+double wxTransformMatrix::Get_scaleY()
+{
+ double scale_factor;
+ double rot_angle = CheckInt(atan2(m_matrix[1][0],m_matrix[0][0])*180/pi);
+ if ( !wxIsSameDouble(rot_angle, 90) && !wxIsSameDouble(rot_angle, -90) )
+ scale_factor = m_matrix[1][1]/cos((rot_angle/180)*pi);
+ else
+ scale_factor = m_matrix[1][1]/sin((rot_angle/180)*pi); // er kan nl. niet door 0 gedeeld worden !
+
+ scale_factor = CheckInt(scale_factor);
+ if (scale_factor < 0)
+
+ scale_factor = -scale_factor;
+
+ return scale_factor;
+
+}
+
+double wxTransformMatrix::GetRotation()
+{
+ double temp1 = GetValue(0,0); // for angle calculation
+ double temp2 = GetValue(0,1); //
+
+ // Rotation
+ double rot_angle = atan2(temp2,temp1)*180/pi;
+
+ rot_angle = CheckInt(rot_angle);
+ return rot_angle;
+}
+
+void wxTransformMatrix::SetRotation(double rotation)
+{
+ double x=GetValue(2,0);
+ double y=GetValue(2,1);
+ Rotate(-GetRotation(), x, y);
+ Rotate(rotation, x, y);
+}