OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimThinPlateSpline.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: thinplatespline.h 14122 2008-03-30 10:33:39Z rouault $
3  *
4  * Project: GDAL Warp API
5  * Purpose: Declarations for 2D Thin Plate Spline transformer.
6  * Author: VIZRT Development Team.
7  *
8  * This code was provided by Gilad Ronnen (gro at visrt dot com) with
9  * permission to reuse under the following license.
10  *
11  ******************************************************************************
12  * Copyright (c) 2004, VIZRT Inc.
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the "Software"),
16  * to deal in the Software without restriction, including without limitation
17  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18  * and/or sell copies of the Software, and to permit persons to whom the
19  * Software is furnished to do so, subject to the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be included
22  * in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  ****************************************************************************/
32 #ifndef ossimThinPlateSpline_HEADER
33 #define ossimThinPlateSpline_HEADER
34 #include <vector>
35 #include <iostream>
38 {
39 public:
40  typedef enum
41  {
47 
49  VIZ_GEOREF_SPLINE_POINT_WAS_DELETED
50 
51  } vizGeorefInterType;
52 
53  ossimThinPlateSpline(int nof_vars = 1){
54  _tx = _ty = 0.0;
55  _ta = 10.0;
56  _nof_points = 0;
57  _nof_vars = nof_vars;
58  _max_nof_points = 0;
59  rhs.resize(_nof_vars);
60  coef.resize(_nof_vars);
61  growPoints();
62  for ( int v = 0; v < _nof_vars; v++ )
63  for ( int i = 0; i < 3; i++ )
64  // rhs[i][v] = 0.0;
65  rhs[v][i] = 0.0;
66  type = VIZ_GEOREF_SPLINE_ZERO_POINTS;
67  }
68 
70  _AA.clear();
71  _Ainv.clear();
72  x.clear();
73  y.clear();
74  u.clear();
75  unused.clear();
76  index.clear();
77  rhs.clear();
78  coef.clear();
79  }
80 
81  int getNumberOfPoints()const
82  {
83  return _nof_points;
84  }
85  void setToler( double tx, double ty ){
86  _tx = tx;
87  _ty = ty;
88  }
89 
90  void getToler( double& tx, double& ty)const {
91  tx = _tx;
92  ty = _ty;
93  }
94 
96  return type;
97  }
98 
99  int deleteList()
100  {
101  _nof_points = 0;
102  type = VIZ_GEOREF_SPLINE_ZERO_POINTS;
103  _AA.clear();
104  _Ainv.clear();
105  return _nof_points;
106  }
107 
108  void growPoints();
109  int addPoint( const double Px, const double Py, const double *Pvars );
110  int deletePoint(const double Px, const double Py );
111  int getPoint( const double Px, const double Py, double *Pvars )const;
112  bool getXy(int index, double& x, double& y)const;
113  bool changePoint(int index, double x, double y, double* Pvars);
114  void reset(void) { _nof_points = 0; }
115  int solve(void);
116 
117 private:
118  double baseFunc( const double x1, const double y1,
119  const double x2, const double y2 )const;
120 
122 
126  int _nof_eqs;
127 
128  double _tx, _ty;
129  double _ta;
130  double _dx, _dy;
131 
132  std::vector<double> x; // [VIZ_GEOREF_SPLINE_MAX_POINTS+3];
133  std::vector<double> y; // [VIZ_GEOREF_SPLINE_MAX_POINTS+3];
134 
135  std::vector<std::vector<double> > rhs;
136  std::vector<std::vector<double> > coef;
137 
138  std::vector<double> u; // [VIZ_GEOREF_SPLINE_MAX_POINTS];
139  std::vector<int> unused; // [VIZ_GEOREF_SPLINE_MAX_POINTS];
140  std::vector<int> index; // [VIZ_GEOREF_SPLINE_MAX_POINTS];
141 
142  std::vector<double> _AA, _Ainv;
143 };
144 
145 #endif
146 
void getToler(double &tx, double &ty) const
ossim_uint32 x
std::vector< int > unused
std::vector< std::vector< double > > rhs
std::vector< std::vector< double > > coef
ossim_uint32 y
vizGeorefInterType getInterpolationType() const
ossimThinPlateSpline(int nof_vars=1)
vizGeorefInterType type
std::vector< double > y
void setToler(double tx, double ty)
std::vector< int > index
std::vector< double > _Ainv
#define OSSIM_DLL
std::vector< double > u
std::vector< double > x