LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
XYTransform.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
30 #ifndef LSST_AFW_GEOM_XYTRANSFORM_H
31 #define LSST_AFW_GEOM_XYTRANSFORM_H
32 
33 #include <string>
34 #include "boost/shared_ptr.hpp"
35 #include "lsst/pex/exceptions.h"
36 #include "lsst/daf/base.h"
38 #include "lsst/afw/geom/ellipses.h"
39 
40 namespace lsst {
41 namespace afw {
42 namespace geom {
43 
44 
49 {
50 public:
53 
54  explicit XYTransform();
55  virtual ~XYTransform() { }
56 
58  virtual PTR(XYTransform) clone() const = 0;
59 
61  virtual PTR(XYTransform) invert() const;
62 
69  virtual Point2D forwardTransform(Point2D const &point) const = 0;
70  virtual Point2D reverseTransform(Point2D const &point) const = 0;
71 
83  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
84  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
85 };
86 
87 
92 {
93 public:
95 
96  virtual PTR(XYTransform) clone() const;
97  virtual Point2D forwardTransform(Point2D const &point) const;
98  virtual Point2D reverseTransform(Point2D const &point) const;
99  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
100  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
101 };
102 
103 
108 {
109 public:
111 
112  virtual PTR(XYTransform) clone() const;
114  virtual PTR(XYTransform) invert() const;
115  virtual Point2D forwardTransform(Point2D const &point) const;
116  virtual Point2D reverseTransform(Point2D const &point) const;
117  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
118  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
119 
120 protected:
122 };
123 
124 
134 {
135 public:
136  typedef std::vector<CONST_PTR(XYTransform)> TransformList;
137  MultiXYTransform(TransformList const &transformList);
138  virtual PTR(XYTransform) clone() const;
139  virtual Point2D forwardTransform(Point2D const &point) const;
140  virtual Point2D reverseTransform(Point2D const &point) const;
141  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
142  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
143  TransformList getTransformList() const { return _transformList; }
144 private:
145  TransformList _transformList;
146 };
147 
153 {
154 public:
155  AffineXYTransform(AffineTransform const &affineTransform);
156 
157  virtual PTR(XYTransform) clone() const;
158  virtual Point2D forwardTransform(Point2D const &position) const;
159  virtual Point2D reverseTransform(Point2D const &position) const;
160  virtual AffineTransform linearizeForwardTransform(Point2D const &position) const;
161  virtual AffineTransform linearizeReverseTransform(Point2D const &position) const;
163  AffineTransform getForwardTransform() const;
165  AffineTransform getReverseTransform() const;
166 
167 protected:
170 };
171 
172 
187 {
188 public:
190  std::vector<double> const &coeffs
191  );
194 
195  virtual PTR(XYTransform) clone() const;
196  virtual PTR(XYTransform) invert() const;
197  virtual Point2D forwardTransform(Point2D const &point) const;
198  virtual Point2D reverseTransform(Point2D const &point) const;
199  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
200  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
201  std::vector<double> getCoeffs() const { return _coeffs; }
202 
209  static std::vector<double> polyInvert(std::vector<double> const &coeffs);
210  static double polyEval(std::vector<double> const &coeffs, double x);
211  static Point2D polyEval(std::vector<double> const &coeffs, Point2D const &p);
212  static double polyEvalDeriv(std::vector<double> const &coeffs, double x);
213 
214  static AffineTransform polyEvalJacobian(std::vector<double> const &coeffs,
215  Point2D const &p);
216 
217  static double polyEvalInverse(std::vector<double> const &coeffs,
218  std::vector<double> const &icoeffs, double x);
219 
220  static Point2D polyEvalInverse(std::vector<double> const &coeffs,
221  std::vector<double> const &icoeffs,
222  Point2D const &p);
223 
224  static AffineTransform polyEvalInverseJacobian(std::vector<double> const &coeffs,
225  std::vector<double> const &icoeffs,
226  Point2D const &p);
227 
228  static AffineTransform makeAffineTransform(double x, double y, double f, double g);
229 
230 protected:
231  std::vector<double> _coeffs;
232  std::vector<double> _icoeffs;
233 };
234 
235 
236 }}}
237 
238 #endif
int y
std::vector< double > _coeffs
Definition: XYTransform.h:231
#define PTR(...)
Definition: base.h:41
Public header class for ellipse library.
#define CONST_PTR(...)
Definition: base.h:47
virtual Point2D reverseTransform(Point2D const &point) const =0
Wrap an XYTransform, swapping forward and reverse transforms.
Definition: XYTransform.h:107
An affine coordinate transformation consisting of a linear transformation and an offset.
virtual boost::shared_ptr< XYTransform > invert() const
returns a &quot;deep inverse&quot; in this sense that the forward+inverse transforms do not share state ...
afw::geom::Point2D Point2D
Definition: XYTransform.h:51
afw::geom::AffineTransform AffineTransform
Definition: XYTransform.h:52
virtual AffineTransform linearizeForwardTransform(Point2D const &point) const
linearized forward and reversed transforms
virtual boost::shared_ptr< XYTransform > clone() const =0
returns a deep copy
int x
std::vector< double > _icoeffs
Definition: XYTransform.h:232
AffineTransform _forwardAffineTransform
Definition: XYTransform.h:168
virtual Point2D forwardTransform(Point2D const &point) const =0
virtuals for forward and reverse transforms
std::vector< boost::shared_ptr< XYTransform const > > TransformList
Definition: XYTransform.h:136
A purely radial polynomial distortion, up to 6th order.
Definition: XYTransform.h:186
Virtual base class for 2D transforms.
Definition: XYTransform.h:48
A trivial XYTransform satisfying f(x)=x.
Definition: XYTransform.h:91
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
Wrap a sequence of multiple XYTransforms.
Definition: XYTransform.h:133
Wrap an AffineTransform.
Definition: XYTransform.h:152
virtual AffineTransform linearizeReverseTransform(Point2D const &point) const
Include files required for standard LSST Exception handling.
std::vector< double > getCoeffs() const
Definition: XYTransform.h:201
AffineTransform _reverseAffineTransform
Definition: XYTransform.h:169