AffineGT.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5  TerraLib is free software: you can redistribute it and/or modify
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19
20 /*!
21  \file terralib/geometry/AffineGT.h
22
23  \brief 2D Affine Geometric transformation.
24 */
25
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_AFFINEGT_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_AFFINEGT_H
28
29 // TerraLib
30 #include "Config.h"
32
33 // Boost
34 #include <boost/concept_check.hpp>
35 #include <boost/numeric/ublas/matrix.hpp>
36
37 namespace te
38 {
39  namespace gm
40  {
41  /*!
42  \class AffineGT
43
44  \brief 2D Affine Geometric transformation.
45
46  \note The transformation parameters (inside GTParameters::m_directParameters) are disposed on the following form:
47
48  \code
49  u = a.x + b.y + c
50  v = d.x + e.y + f
51
52  | u | | a b c | | x |
53  | v | = | d e f | * | y |
54  | 1 | | 0 0 1 | | 1 |
55
56  |u0| |x0 y0 1 0 0 0|.|a|
57  |v0| |0 0 0 x0 y0 1| |b|
58  |u1| = |x1 y1 1 0 0 0| |c|
59  |v1| |0 0 0 x1 y1 1| |d|
60  |..| |....................| |e|
61  |..| |....................| |f|
62
63  GTParameters::m_directParameters = [ a b c d e f ]
64  \endcode
65  */
67  {
68  public:
69
70  /*! \brief Default constructor. */
71  AffineGT();
72
73  /*! \brief Destructor. */
74  ~AffineGT();
75
76  const std::string& getName() const;
77
78  bool isValid(const GTParameters& params) const;
79
80  void directMap(const GTParameters& params,
81  const double& pt1X,
82  const double& pt1Y,
83  double& pt2X,
84  double& pt2Y) const;
85
86  void inverseMap(const GTParameters& params,
87  const double& pt2X,
88  const double& pt2Y,
89  double& pt1X,
90  double& pt1Y) const;
91
92  unsigned int getMinRequiredTiePoints() const;
93
94  GeometricTransformation* clone() const;
95
96  /*!
97  \brief Returns the basic set of transform parameters given by the decomposition of a given affine transformation parameters as described above.
98
99  \param transfParams Input affine transformation parameters.
100  \param translationX X axis translation (combination of a squeeze and scaling).
101  \param translationY Y axis translation (combination of a squeeze and scaling).
102  \param scalingFactorX X axis scaling.
103  \param scalingFactorX Y axis scaling.
104  \param skew Skew.
105  \param squeeze Aspect ratio changes.
106  \param scaling Uniform scaling.
107  \param rotation Rotation angle (radians).
108
109  \return true if ok, false on errors.
110  */
111  static bool decompose(const std::vector< double >& transfParams,
112  double& translationX, double& translationY,
113  double& scalingFactorX, double& scalingFactorY, double& skew,
114  double& squeeze, double& scaling, double& rotation);
115
116  protected:
117
118  // Variables used by method computeParameters
119  mutable unsigned int m_computeParameters_tiepointsSize;
120  mutable unsigned int m_computeParameters_index1;
121  mutable unsigned int m_computeParameters_index2;
122  mutable unsigned int m_computeParameters_tpIdx;
123  mutable boost::numeric::ublas::matrix< double > m_computeParameters_L;
124  mutable boost::numeric::ublas::matrix< double > m_computeParameters_A;
125  mutable boost::numeric::ublas::matrix< double > m_computeParameters_At;
126  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N;
127  mutable boost::numeric::ublas::matrix< double > m_computeParameters_U;
128  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N_inv;
129  mutable boost::numeric::ublas::matrix< double > m_computeParameters_X;
130  mutable boost::numeric::ublas::matrix< double > m_computeParameters_XExpanded;
131  mutable boost::numeric::ublas::matrix< double > m_computeParameters_XExpandedInv;
132
133  bool computeParameters(GTParameters& params) const;
134  };
135
136  } // end namespace gm
137 } // end namespace te
138
139 #endif // __TERRALIB_GEOMETRY_INTERNAL_GAFFINEGT_H
140
2D Geometric transformation base class.
boost::numeric::ublas::matrix< double > m_computeParameters_U
Definition: AffineGT.h:127
unsigned int m_computeParameters_tiepointsSize
Definition: AffineGT.h:119
boost::numeric::ublas::matrix< double > m_computeParameters_L
Definition: AffineGT.h:123
boost::numeric::ublas::matrix< double > m_computeParameters_A
Definition: AffineGT.h:124
boost::numeric::ublas::matrix< double > m_computeParameters_XExpandedInv
Definition: AffineGT.h:131
unsigned int m_computeParameters_index1
Definition: AffineGT.h:120
unsigned int m_computeParameters_tpIdx
Definition: AffineGT.h:122
2D Geometric transformation base class.
unsigned int m_computeParameters_index2
Definition: AffineGT.h:121
2D Affine Geometric transformation.
Definition: AffineGT.h:66
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
URI C++ Library.
boost::numeric::ublas::matrix< double > m_computeParameters_XExpanded
Definition: AffineGT.h:130
boost::numeric::ublas::matrix< double > m_computeParameters_At
Definition: AffineGT.h:125
boost::numeric::ublas::matrix< double > m_computeParameters_X
Definition: AffineGT.h:129
boost::numeric::ublas::matrix< double > m_computeParameters_N_inv
Definition: AffineGT.h:128
2D Geometric transformation parameters.
Definition: GTParameters.h:50
boost::numeric::ublas::matrix< double > m_computeParameters_N
Definition: AffineGT.h:126
Configuration flags for the Vector Geometry Model of TerraLib.