lsst.afw  14.0-40-g0271be365
PositionFunctor.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008 - 2012 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  * image warping
27  */
28 #ifndef LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
29 #define LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
30 
31 #include "lsst/afw/geom/Point.h"
35 #include "lsst/afw/image/Wcs.h"
36 
37 namespace lsst {
38 namespace afw {
39 namespace math {
40 namespace detail {
41 
54 public:
55  explicit PositionFunctor(){};
56  virtual ~PositionFunctor(){};
57 
58  virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const = 0;
59 };
60 
65 public:
67  lsst::afw::geom::Point2D const &destXY0,
68  lsst::afw::geom::XYTransform const &XYTransform
69  )
71  : PositionFunctor(), _destXY0(destXY0), _xyTransformPtr(XYTransform.clone()) {}
72 
74 
75  virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const {
76  afw::geom::Point2D const destPos{lsst::afw::image::indexToPosition(destCol + _destXY0[0]),
77  lsst::afw::image::indexToPosition(destRow + _destXY0[1])};
78  return _xyTransformPtr->reverseTransform(destPos);
79  }
80 
81 private:
82  lsst::afw::geom::Point2D const _destXY0;
84 };
85 }
86 }
87 }
88 } // namespace lsst::afw::math::detail
89 
90 #endif // !defined(LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H)
Functor class that wraps an XYTransform.
double indexToPosition(double ind)
Convert image index to image position.
Definition: ImageUtils.h:55
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const
XYTransformPositionFunctor(lsst::afw::geom::Point2D const &destXY0, lsst::afw::geom::XYTransform const &XYTransform)
Base class to transform pixel position for a destination image to its position in the original source...
A base class for image defects.
Virtual base class for 2D transforms.
Definition: XYTransform.h:49
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const =0