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
MultiXYTransform.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2014 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 "lsst/pex/exceptions.h"
27 #include <memory>
28 
29 namespace pexEx = lsst::pex::exceptions;
30 
31 namespace lsst {
32 namespace afw {
33 namespace geom {
34 
36  : XYTransform(), _transformList(transformList) {
37  for (TransformList::const_iterator trIter = _transformList.begin(); trIter != _transformList.end();
38  ++trIter) {
39  if (!bool(*trIter)) {
40  throw LSST_EXCEPT(pexEx::InvalidParameterError, "One or more transforms is null");
41  }
42  }
43 }
44 
45 MultiXYTransform::MultiXYTransform(MultiXYTransform const &) = default;
46 MultiXYTransform::MultiXYTransform(MultiXYTransform &&) = default;
47 MultiXYTransform &MultiXYTransform::operator=(MultiXYTransform const &) = default;
48 MultiXYTransform &MultiXYTransform::operator=(MultiXYTransform &&) = default;
50 
52  return std::make_shared<MultiXYTransform>(_transformList);
53 }
54 
56  Point2D retPoint = point;
57  for (TransformList::const_iterator trIter = _transformList.begin(); trIter != _transformList.end();
58  ++trIter) {
59  retPoint = (*trIter)->forwardTransform(retPoint);
60  }
61  return retPoint;
62 }
63 
65  Point2D retPoint = point;
66  for (TransformList::const_reverse_iterator trIter = _transformList.rbegin();
67  trIter != _transformList.rend(); ++trIter) {
68  retPoint = (*trIter)->reverseTransform(retPoint);
69  }
70  return retPoint;
71 }
72 
74  Point2D tempPt = point;
75  AffineTransform retTransform = AffineTransform();
76  for (TransformList::const_iterator trIter = _transformList.begin(); trIter != _transformList.end();
77  ++trIter) {
78  AffineTransform tempTransform = (*trIter)->linearizeForwardTransform(tempPt);
79  tempPt = tempTransform(tempPt);
80  retTransform = tempTransform * retTransform;
81  }
82  return retTransform;
83 }
84 
86  Point2D tempPt = point;
87  AffineTransform retTransform = AffineTransform();
88  for (TransformList::const_reverse_iterator trIter = _transformList.rbegin();
89  trIter != _transformList.rend(); ++trIter) {
90  AffineTransform tempTransform = (*trIter)->linearizeReverseTransform(tempPt);
91  tempPt = tempTransform(tempPt);
92  retTransform = tempTransform * retTransform;
93  }
94  return retTransform;
95 }
96 }
97 }
98 }
MultiXYTransform(TransformList const &transformList)
Include files required for standard LSST Exception handling.
A base class for image defects.
Definition: cameraGeom.dox:3
An affine coordinate transformation consisting of a linear transformation and an offset.
virtual Point2D reverseTransform(Point2D const &point) const
virtual AffineTransform linearizeReverseTransform(Point2D const &point) const
default implementation; subclass may override
virtual AffineTransform linearizeForwardTransform(Point2D const &point) const
linearized forward and reversed transforms
virtual Point2D forwardTransform(Point2D const &point) const
virtuals for forward and reverse transforms
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Definition: Exception.h:46
STL class.
virtual std::shared_ptr< XYTransform > clone() const
returns a deep copy
MultiXYTransform & operator=(MultiXYTransform const &)