All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Matrix2D.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2020 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPCommonMatrix2D
6 #define PDFTRON_H_CPPCommonMatrix2D
7 
8 #include <Common/Common.h>
9 #include <C/Common/TRN_Types.h>
10 #include <C/Common/TRN_Matrix2D.h>
11 #include <PDF/Point.h>
12 #include <vector>
13 
14 
15 namespace pdftron {
16  namespace Common {
17 
18 
103 class Matrix2D : public TRN_Matrix2D
104 {
105 public:
106 
120  Matrix2D(double a = 1, double b = 0, double c = 0, double d = 1, double h = 0, double v = 0);
121 
125  Matrix2D(const Matrix2D& m);
126 
130  Matrix2D& operator= (const Matrix2D& m);
131 
142  void Set (double a, double b, double c, double d, double h, double v);
143 
155  void Concat(double a, double b, double c, double d, double h, double v);
156 
157 #if !defined(SWIG)
158 
164  Matrix2D& operator*= (const Matrix2D& m);
165 
171  Matrix2D operator* (const Matrix2D& m) const;
172 
180  bool operator== (const Matrix2D& m) const;
181 
189  bool operator!= (const Matrix2D& m) const {return !(this->operator ==(m));}
190 #else // !defined(SWIG)
191  Matrix2D Multiply(const Matrix2D& m);
192  bool IsEquals(const Matrix2D& m) const;
193  bool IsNotEquals(const Matrix2D& m) const
194  {
195  return (!this->IsEquals(m));
196  }
197 #endif // !defined(SWIG)
198 
201  PDF::Point Mult(const PDF::Point & pt) const;
202 
203 #ifndef SWIG
204  void Mult(double& in_out_x, double& in_out_y) const;
205 #endif
206 
207 
211  Matrix2D Inverse () const;
212 
222  void Translate (double h, double v);
223 
231  void PreTranslate(double h, double v);
232 
240  void PostTranslate(double h, double v);
241 
247  void Scale (double h, double v);
248 
252  static Matrix2D ZeroMatrix ();
253 
257  static Matrix2D IdentityMatrix ();
258 
264  static Matrix2D RotationMatrix (const double angle);
265 };
266 
267 
268 #include <Impl/Matrix2D.inl>
269 
270  }; // namespace Common
271 }; // namespace pdftron
272 
273 #endif // PDFTRON_H_CPPCommonMatrix2D
Matrix2D Inverse() const
Matrix2D & operator*=(const Matrix2D &m)
bool operator==(const Matrix2D &m) const
void PostTranslate(double h, double v)
void PreTranslate(double h, double v)
Matrix2D(double a=1, double b=0, double c=0, double d=1, double h=0, double v=0)
bool operator!=(const Matrix2D &m) const
Definition: Matrix2D.h:189
PDF::Point Mult(const PDF::Point &pt) const
void Set(double a, double b, double c, double d, double h, double v)
void Translate(double h, double v)
Matrix2D & operator=(const Matrix2D &m)
static Matrix2D ZeroMatrix()
void Concat(double a, double b, double c, double d, double h, double v)
Matrix2D operator*(const Matrix2D &m) const
void Scale(double h, double v)
static Matrix2D IdentityMatrix()
static Matrix2D RotationMatrix(const double angle)