LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
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,2> const & xCoeffs,
72  ndarray::Array<double const,2,2> 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 
218 
221 
226 
231 
232 private:
237 };
238 
246 
254 
255 }}} // namespace lsst::meas::astrom
256 
257 #endif // !LSST_MEAS_ASTROM_PolynomialTransform_INCLUDED
PolynomialTransform & operator=(PolynomialTransform const &other)
Copy assignment.
afw::geom::AffineTransform linearize(afw::geom::Point2D const &in) const
Return an approximate affine transform at the given point.
static ScaledPolynomialTransform convert(PolynomialTransform const &poly)
Convert a PolynomialTransform to an equivalent ScaledPolynomialTransform.
ndarray::EigenView< double, 2, 2 > _yCoeffs
afw::geom::AffineTransform const & getInputScaling() const
Return the first affine transform applied to input points.
PolynomialTransform const & getPoly() const
Return the polynomial transform applied after the input scaling.
PolynomialTransform compose(afw::geom::AffineTransform const &t1, PolynomialTransform const &t2)
Return a PolynomialTransform that is equivalent to the composition t1(t2())
A fitter class for scaled polynomial transforms.
afw::geom::AffineTransform const & getOutputScalingInverse() const
Return the affine transform applied to points after the polynomial transform.
afw::geom::AffineTransform linearize(afw::geom::Point2D const &in) const
Return an approximate affine transform at the given point.
A transform that maps pixel coordinates to intermediate world coordinates according to the SIP conven...
Definition: SipTransform.h:150
void swap(ScaledPolynomialTransform &other)
An affine coordinate transformation consisting of a linear transformation and an offset.
void swap(PolynomialTransform &other)
Lightweight swap.
afw::geom::Point2D operator()(afw::geom::Point2D const &in) const
Apply the transform to a point.
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:268
ScaledPolynomialTransform(PolynomialTransform const &poly, afw::geom::AffineTransform const &inputScaling, afw::geom::AffineTransform const &outputScalingInverse)
Construct a new ScaledPolynomialTransform from its constituents.
ndarray::EigenView< double, 2, 2 > _xCoeffs
ndarray::Array< double const, 2, 2 > getYCoeffs() const
2-D polynomial coefficients that compute the output x coordinate.
ndarray::Array< double const, 2, 2 > getXCoeffs() const
2-D polynomial coefficients that compute the output x coordinate.
int getOrder() const
Return the order of the polynomials.
static PolynomialTransform convert(ScaledPolynomialTransform const &other)
Convert a ScaledPolynomialTransform to an equivalent PolynomialTransform.
friend PolynomialTransform compose(afw::geom::AffineTransform const &t1, PolynomialTransform const &t2)
Return a PolynomialTransform that is equivalent to the composition t1(t2())
ScaledPolynomialTransform & operator=(ScaledPolynomialTransform const &other)=default
PolynomialTransform(ndarray::Array< double const, 2, 2 > const &xCoeffs, ndarray::Array< double const, 2, 2 > const &yCoeffs)
Construct a new transform from existing coefficient arrays.
afw::geom::Point2D operator()(afw::geom::Point2D const &in) const
Apply the transform to a point.
A 2-d coordinate transform represented by a pair of standard polynomials (one for each coordinate)...