lsst.afw  15.0-16-g953e39cab
SeparableXYTransform.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2015 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 #include <cmath>
26 
27 #include "lsst/afw/geom/Functor.h"
29 
30 namespace lsst {
31 namespace afw {
32 namespace geom {
33 
35  : XYTransform(), _xfunctor(xfunctor.clone()), _yfunctor(yfunctor.clone()) {}
36 
41 
43  return std::make_shared<SeparableXYTransform>(*_xfunctor, *_yfunctor);
44 }
45 
47  double xin = point.getX();
48  double yin = point.getY();
49  double xout = (*_xfunctor)(xin);
50  double yout = (*_yfunctor)(yin);
51  return Point2D(xout, yout);
52 }
53 
55  double xout = point.getX();
56  double yout = point.getY();
57  double xin = 0;
58  double yin = 0;
59  try {
60  xin = _xfunctor->inverse(xout);
61  yin = _yfunctor->inverse(yout);
63  LSST_EXCEPT_ADD(e, "Called from SeparableXYTransform::reverseTransform");
64  throw;
65  }
66  return Point2D(xin, yin);
67 }
68 
69 Functor const& SeparableXYTransform::getXfunctor() const { return *_xfunctor; }
70 
71 Functor const& SeparableXYTransform::getYfunctor() const { return *_yfunctor; }
72 
73 } // namespace geom
74 } // namespace afw
75 } // namespace lsst
virtual Point2D forwardTransform(Point2D const &point) const
virtual Point2D reverseTransform(Point2D const &point) const
A base class for image defects.
SeparableXYTransform & operator=(SeparableXYTransform const &)
SeparableXYTransform(Functor const &xfunctor, Functor const &yfunctor)
virtual std::shared_ptr< XYTransform > clone() const
returns a deep copy
A 2D transform for which the pixel distortions in the in the x- and y-directions are separable...
Virtual base class for 2D transforms.
Definition: XYTransform.h:49
Abstract base class for function objects.
Definition: Functor.h:50
#define LSST_EXCEPT_ADD(e, m)
afw::geom::Point2D Point2D
Definition: XYTransform.h:51