lsst.meas.astrom  14.0-7-g0d69b06+3
PolynomialTransform.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2016 LSST/AURA
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 #ifndef LSST_MEAS_ASTROM_PolynomialTransform_INCLUDED
25 #define LSST_MEAS_ASTROM_PolynomialTransform_INCLUDED
26 
27 #include "ndarray/eigen.h"
29 
30 namespace lsst { namespace meas { namespace astrom {
31 
32 class SipForwardTransform;
33 class SipReverseTransform;
34 class ScaledPolynomialTransform;
35 
43 public:
44 
49 
53  static PolynomialTransform convert(SipForwardTransform const & other);
54 
58  static PolynomialTransform convert(SipReverseTransform const & other);
59 
71  ndarray::Array<double const,2,0> const & xCoeffs,
72  ndarray::Array<double const,2,0> const & yCoeffs
73  );
74 
81 
88 
95 
102 
104  void swap(PolynomialTransform & other);
105 
107  int getOrder() const { return _xCoeffs.rows() - 1; }
108 
115  ndarray::Array<double const,2,2> getXCoeffs() const { return _xCoeffs.shallow(); }
116 
123  ndarray::Array<double const,2,2> getYCoeffs() const { return _yCoeffs.shallow(); }
124 
129 
134 
135 private:
136 
137  PolynomialTransform(int order);
138 
142  friend class SipForwardTransform;
143  friend class SipReverseTransform;
145 
146  ndarray::EigenView<double,2,2> _xCoeffs;
147  ndarray::EigenView<double,2,2> _yCoeffs;
148  mutable Eigen::VectorXd _u; // workspace for operator() and linearize
149  mutable Eigen::VectorXd _v;
150 };
151 
159 public:
160 
168 
176  static ScaledPolynomialTransform convert(SipForwardTransform const & sipForward);
177 
185  static ScaledPolynomialTransform convert(SipReverseTransform const & sipReverse);
186 
198  PolynomialTransform const & poly,
199  afw::geom::AffineTransform const & inputScaling,
200  afw::geom::AffineTransform const & outputScalingInverse
201  );
202 
203  ScaledPolynomialTransform(ScaledPolynomialTransform const & other) = default;
204 
206 
208 
210 
211  void swap(ScaledPolynomialTransform & other);
212 
214  PolynomialTransform const & getPoly() const { return _poly; }
215 
217  afw::geom::AffineTransform const & getInputScaling() const { return _inputScaling; }
218 
220  afw::geom::AffineTransform const & getOutputScalingInverse() const { return _outputScalingInverse; }
221 
226 
231 
232 private:
234  PolynomialTransform _poly;
235  afw::geom::AffineTransform _inputScaling;
236  afw::geom::AffineTransform _outputScalingInverse;
237 };
238 
246 
254 
255 }}} // namespace lsst::meas::astrom
256 
257 #endif // !LSST_MEAS_ASTROM_PolynomialTransform_INCLUDED
afw::geom::Point2D operator()(afw::geom::Point2D const &in) const
Apply the transform to a point.
afw::geom::AffineTransform linearize(afw::geom::Point2D const &in) const
Return an approximate affine transform at the given point.
ndarray::Array< double const, 2, 2 > getXCoeffs() const
2-D polynomial coefficients that compute the output x coordinate.
PolynomialTransform const & getPoly() const
Return the polynomial transform applied after the input scaling.
A fitter class for scaled polynomial transforms.
A transform that maps pixel coordinates to intermediate world coordinates according to the SIP conven...
Definition: SipTransform.h:150
PolynomialTransform(ndarray::Array< double const, 2, 0 > const &xCoeffs, ndarray::Array< double const, 2, 0 > const &yCoeffs)
Construct a new transform from existing coefficient arrays.
void swap(PolynomialTransform &other)
Lightweight swap.
PolynomialTransform & operator=(PolynomialTransform const &other)
Copy assignment.
static PolynomialTransform convert(ScaledPolynomialTransform const &other)
Convert a ScaledPolynomialTransform to an equivalent PolynomialTransform.
afw::geom::AffineTransform const & getInputScaling() const
Return the first affine transform applied to input points.
A 2-d coordinate transform represented by a lazy composition of an AffineTransform, a PolynomialTransform, and another AffineTransform.
A transform that maps intermediate world coordinates to pixel coordinates according to the SIP conven...
Definition: SipTransform.h:274
afw::geom::AffineTransform const & getOutputScalingInverse() const
Return the affine transform applied to points after the polynomial transform.
friend PolynomialTransform compose(afw::geom::AffineTransform const &t1, PolynomialTransform const &t2)
Return a PolynomialTransform that is equivalent to the composition t1(t2())
ndarray::Array< double const, 2, 2 > getYCoeffs() const
2-D polynomial coefficients that compute the output x coordinate.
int getOrder() const
Return the order of the polynomials.
A 2-d coordinate transform represented by a pair of standard polynomials (one for each coordinate)...