Board  0.9.5
TransformMatrix.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
26 #ifndef BOARD_TRANSFORM_MATRIX_H
27 #define BOARD_TRANSFORM_MATRIX_H
28 
29 #include <cmath>
30 #include <iostream>
31 #include "Point.h"
32 
33 namespace LibBoard
34 {
35 
37 public:
38  enum Type
39  {
40  SVG,
41  Postscript
42  };
43 
44  inline TransformMatrix();
45  inline TransformMatrix(double m11, double m12, double m13, double m21, double m22, double m23);
46 
47  static TransformMatrix translation(double dx, double dy);
48  static TransformMatrix translation(const Point &);
49  static TransformMatrix scaling(double sx, double sy);
50  static TransformMatrix rotation(double angle, Type type);
51  static TransformMatrix rotation(double angle, const Point & center, Type type);
52 
53  TransformMatrix operator*(const TransformMatrix &)const;
54 
55  TransformMatrix & operator*=(const TransformMatrix &);
56 
57  Point operator*(const Point & point) const;
58 
59  TransformMatrix operator+(const Point &) const;
60 
61  TransformMatrix & operator+=(const Point &);
62 
63  void flushSVG(std::ostream &) const;
64 
65  void flushEPS(std::ostream &) const;
66 
67 private:
68  double _m11, _m12, _m13;
69  double _m21, _m22, _m23;
70 };
71 
72 // inline methods
73 
74 TransformMatrix::TransformMatrix()
75 {
76  _m11 = 1.0;
77  _m12 = 0.0;
78  _m13 = 0.0;
79  _m21 = 0.0;
80  _m22 = 1.0;
81  _m23 = 0.0;
82 }
83 
84 TransformMatrix::TransformMatrix(double m11, double m12, double m13, double m21, double m22, double m23) : _m11(m11), _m12(m12), _m13(m13), _m21(m21), _m22(m22), _m23(m23) {}
85 
86 } // namespace LibBoard
87 
88 #endif /* BOARD_TRANSFORM_MATRIX_H */
Point.h
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
LibBoard::Point
Struct representing a 2D point.
Definition: Point.h:42
LibBoard::TransformMatrix
Definition: TransformMatrix.h:36