All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AffineGT.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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
6  it under the terms of the GNU Lesser General Public License as published by
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 
36 namespace te
37 {
38  namespace gm
39  {
40  /*!
41  \class AffineGT
42 
43  \brief 2D Affine Geometric transformation.
44 
45  \note The transformation parameters (inside GTParameters::m_directParameters) are disposed on the following form:
46 
47  \code
48  u = a.x + b.y + c
49  v = d.x + e.y + f
50 
51  | u | | a b c | | x |
52  | v | = | d e f | * | y |
53  | 1 | | 0 0 1 | | 1 |
54 
55  |u0| |x0 y0 1 0 0 0|.|a|
56  |v0| |0 0 0 x0 y0 1| |b|
57  |u1| = |x1 y1 1 0 0 0| |c|
58  |v1| |0 0 0 x1 y1 1| |d|
59  |..| |....................| |e|
60  |..| |....................| |f|
61 
62  GTParameters::m_directParameters = [ a b c d e f ]
63  \endcode
64  */
66  {
67  public:
68 
69  /*! \brief Default constructor. */
70  AffineGT();
71 
72  /*! \brief Destructor. */
73  ~AffineGT();
74 
75  const std::string& getName() const;
76 
77  bool isValid(const GTParameters& params) const;
78 
79  void directMap(const GTParameters& params,
80  const double& pt1X,
81  const double& pt1Y,
82  double& pt2X,
83  double& pt2Y) const;
84 
85  void inverseMap(const GTParameters& params,
86  const double& pt2X,
87  const double& pt2Y,
88  double& pt1X,
89  double& pt1Y) const;
90 
91  unsigned int getMinRequiredTiePoints() const;
92 
93  GeometricTransformation* clone() const;
94 
95  /*!
96  \brief Returns the basic set of transform parameters given by the decomposition of a given affine transformation parameters as described above.
97 
98  \param transfParams Input affine transformation parameters.
99  \param translationX X axis translation (combination of a squeeze and scaling).
100  \param translationY Y axis translation (combination of a squeeze and scaling).
101  \param scalingFactorX X axis scaling.
102  \param scalingFactorX Y axis scaling.
103  \param skew Skew.
104  \param squeeze Aspect ratio changes.
105  \param scaling Uniform scaling.
106  \param rotation Rotation angle (radians).
107 
108  \return true if ok, false on errors.
109  */
110  static bool decompose(const std::vector< double >& transfParams,
111  double& translationX, double& translationY,
112  double& scalingFactorX, double& scalingFactorY, double& skew,
113  double& squeeze, double& scaling, double& rotation);
114 
115  protected:
116 
117  bool computeParameters(GTParameters& params) const;
118  };
119 
120  } // end namespace gm
121 } // end namespace te
122 
123 #endif // __TERRALIB_GEOMETRY_INTERNAL_GAFFINEGT_H
124 
2D Geometric transformation base class.
2D Geometric transformation base class.
2D Affine Geometric transformation.
Definition: AffineGT.h:65
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:79
2D Geometric transformation parameters.
Definition: GTParameters.h:50
Configuration flags for the Vector Geometry Model of TerraLib.