LSSTApplications  11.0-24-g0a022a1,14.0+64,15.0,15.0+1,15.0-1-g14e9bfd,15.0-1-g1eca518,15.0-1-g499c38d,15.0-1-g60afb23,15.0-1-g6668b0b,15.0-1-g788a293,15.0-1-g82223af,15.0-1-ga91101e,15.0-1-gae1598d,15.0-1-gc45031d,15.0-1-gd076f1f,15.0-1-gf4f1c34,15.0-1-gfe1617d,15.0-16-g953e39cab,15.0-2-g2010ef9,15.0-2-g33d94b3,15.0-2-g5218728,15.0-2-g947dc0d,15.0-3-g9103c06,15.0-3-ga03b4ca,15.0-3-ga659d1f3,15.0-3-ga695220+2,15.0-3-gaec6799,15.0-3-gb7a597c,15.0-3-gd5b9ff95,15.0-4-g0478fed+2,15.0-4-g45f767a,15.0-4-gff20472+2,15.0-6-ge2d9597
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 
25 /*
26  * Class representing an invertible 2D transform
27  */
28 
29 #ifndef LSST_AFW_GEOM_XYTRANSFORM_H
30 #define LSST_AFW_GEOM_XYTRANSFORM_H
31 
32 #include <string>
33 #include <memory>
34 #include "lsst/pex/exceptions.h"
35 #include "lsst/daf/base.h"
37 #include "lsst/afw/geom/ellipses.h"
38 
39 namespace lsst {
40 namespace afw {
41 namespace geom {
42 
50 public:
53 
54  explicit XYTransform();
55  XYTransform(XYTransform const &);
59  virtual ~XYTransform() = default;
60 
62  virtual std::shared_ptr<XYTransform> clone() const = 0;
63 
67  virtual std::shared_ptr<XYTransform> invert() const;
68 
75  virtual Point2D forwardTransform(Point2D const &point) const = 0;
76  virtual Point2D reverseTransform(Point2D const &point) const = 0;
77 
92  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
95  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
96 };
97 
105 public:
112 
113  virtual std::shared_ptr<XYTransform> clone() const;
114  virtual Point2D forwardTransform(Point2D const &point) const;
115  virtual Point2D reverseTransform(Point2D const &point) const;
116  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
117  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
118 };
119 
127 public:
134 
135  virtual std::shared_ptr<XYTransform> clone() const;
137  virtual std::shared_ptr<XYTransform> invert() const;
138  virtual Point2D forwardTransform(Point2D const &point) const;
139  virtual Point2D reverseTransform(Point2D const &point) const;
140  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
141  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
142 
143 protected:
145 };
146 
159 public:
161  MultiXYTransform(TransformList const &transformList);
166  ~MultiXYTransform();
167 
168  virtual std::shared_ptr<XYTransform> clone() const;
169  virtual Point2D forwardTransform(Point2D const &point) const;
170  virtual Point2D reverseTransform(Point2D const &point) const;
171  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
172  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
173  TransformList getTransformList() const { return _transformList; }
174 
175 private:
176  TransformList _transformList;
177 };
178 
186 public:
193 
194  virtual std::shared_ptr<XYTransform> clone() const;
195  virtual Point2D forwardTransform(Point2D const &position) const;
196  virtual Point2D reverseTransform(Point2D const &position) const;
197  virtual AffineTransform linearizeForwardTransform(Point2D const &position) const;
198  virtual AffineTransform linearizeReverseTransform(Point2D const &position) const;
200  AffineTransform getForwardTransform() const;
202  AffineTransform getReverseTransform() const;
203 
204 protected:
207 };
208 
226 public:
232 
233  );
239 
240  virtual std::shared_ptr<XYTransform> clone() const;
241  virtual std::shared_ptr<XYTransform> invert() const;
242  virtual Point2D forwardTransform(Point2D const &point) const;
243  virtual Point2D reverseTransform(Point2D const &point) const;
244  virtual AffineTransform linearizeForwardTransform(Point2D const &point) const;
245  virtual AffineTransform linearizeReverseTransform(Point2D const &point) const;
246  std::vector<double> getCoeffs() const { return _coeffs; }
247 
254  static std::vector<double> polyInvert(std::vector<double> const &coeffs);
255  static double polyEval(std::vector<double> const &coeffs, double x);
256  static Point2D polyEval(std::vector<double> const &coeffs, Point2D const &p);
257  static double polyEvalDeriv(std::vector<double> const &coeffs, double x);
258 
259  static AffineTransform polyEvalJacobian(std::vector<double> const &coeffs, Point2D const &p);
260 
261  static double polyEvalInverse(std::vector<double> const &coeffs, std::vector<double> const &icoeffs,
262  double x);
263 
264  static Point2D polyEvalInverse(std::vector<double> const &coeffs, std::vector<double> const &icoeffs,
265  Point2D const &p);
266 
267  static AffineTransform polyEvalInverseJacobian(std::vector<double> const &coeffs,
268  std::vector<double> const &icoeffs, Point2D const &p);
269 
270  static AffineTransform makeAffineTransform(double x, double y, double f, double g);
271 
272 protected:
275 };
276 }
277 }
278 }
279 
280 #endif
std::vector< double > _coeffs
Definition: XYTransform.h:273
AffineTransform _forwardAffineTransform
Definition: XYTransform.h:205
XYTransform & operator=(XYTransform const &)
virtual Point2D reverseTransform(Point2D const &point) const =0
virtual Point2D forwardTransform(Point2D const &point) const =0
virtuals for forward and reverse transforms
virtual AffineTransform linearizeReverseTransform(Point2D const &point) const
default implementation; subclass may override
Definition: XYTransform.cc:47
Include files required for standard LSST Exception handling.
int y
Definition: SpanSet.cc:43
Wrap an XYTransform, swapping forward and reverse transforms.
Definition: XYTransform.h:126
virtual std::shared_ptr< XYTransform > clone() const =0
returns a deep copy
A base class for image defects.
Definition: cameraGeom.dox:3
An affine coordinate transformation consisting of a linear transformation and an offset.
std::vector< std::shared_ptr< XYTransform const > > TransformList
Definition: XYTransform.h:160
virtual std::shared_ptr< XYTransform > invert() const
returns a "deep inverse" in this sense that the forward+inverse transforms do not share state default...
Definition: XYTransform.cc:55
afw::geom::AffineTransform AffineTransform
Definition: XYTransform.h:52
std::vector< double > getCoeffs() const
Definition: XYTransform.h:246
double x
std::vector< double > _icoeffs
Definition: XYTransform.h:274
AffineTransform _reverseAffineTransform
Definition: XYTransform.h:206
STL class.
virtual AffineTransform linearizeForwardTransform(Point2D const &point) const
linearized forward and reversed transforms
Definition: XYTransform.cc:39
A purely radial polynomial distortion, up to 6th order.
Definition: XYTransform.h:225
Virtual base class for 2D transforms.
Definition: XYTransform.h:49
A trivial XYTransform satisfying f(x)=x.
Definition: XYTransform.h:104
TransformList getTransformList() const
Definition: XYTransform.h:173
virtual ~XYTransform()=default
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:53
Wrap a sequence of multiple XYTransforms.
Definition: XYTransform.h:158
std::shared_ptr< XYTransform const > _base
Definition: XYTransform.h:144
Wrap an AffineTransform.
Definition: XYTransform.h:185
afw::geom::Point2D Point2D
Definition: XYTransform.h:51