LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
radii.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 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 #ifndef LSST_AFW_GEOM_ELLIPSES_radii_h_INCLUDED
26 #define LSST_AFW_GEOM_ELLIPSES_radii_h_INCLUDED
27 
37 #include <complex>
38 
39 namespace lsst { namespace afw { namespace geom {
40 namespace ellipses {
41 
42 #ifndef SWIG
43 template <typename Ellipticity_, typename Radius_> class Separable;
44 #endif
45 
46 class DeterminantRadius;
47 class TraceRadius;
49 class LogTraceRadius;
50 
58 public:
59 
60  void normalize() {
61  if (_value < 0)
62  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
63  "Ellipse radius cannot be negative.");
64  }
65 
66  static std::string getName() { return "DeterminantRadius"; }
67 
68  explicit DeterminantRadius(double value=1.0) : _value(value) {}
69 
70  explicit DeterminantRadius(LogDeterminantRadius const & other);
71 
72  operator double const & () const { return _value; }
73 
74  operator double & () { return _value; }
75 
76  DeterminantRadius & operator=(double value) { _value = value; return *this; }
77 
79 
80 private:
81 
82  template <typename T1, typename T2> friend class Separable;
83 
85  void operator=(TraceRadius const &);
87  void operator=(LogTraceRadius const &);
88 
90  double ixx, double iyy, double ixy,
91  Distortion & distortion
92  );
93 
95  double ixx, double iyy, double ixy,
96  Distortion & distortion
97  );
98 
99  void assignToQuadrupole(
100  Distortion const & distortion,
101  double & ixx, double & iyy, double & ixy
102  ) const;
103 
105  Distortion const & distortion,
106  double & ixx, double & iyy, double & ixy
107  ) const;
108 
109  double _value;
110 };
111 
117 class TraceRadius {
118 public:
119 
120  void normalize() {
121  if (_value < 0)
122  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
123  "Ellipse radius cannot be negative.");
124  }
125 
126  static std::string getName() { return "TraceRadius"; }
127 
128  explicit TraceRadius(double value=1.0) : _value(value) {}
129 
130  explicit TraceRadius(LogTraceRadius const & other);
131 
132  operator double const & () const { return _value; }
133 
134  operator double & () { return _value; }
135 
136  TraceRadius & operator=(double value) { _value = value; return *this; }
137 
138  TraceRadius & operator=(LogTraceRadius const & other);
139 
140 private:
141 
142  template <typename T1, typename T2> friend class Separable;
143 
145  void operator=(DeterminantRadius const &);
147  void operator=(LogDeterminantRadius const &);
148 
150  double ixx, double iyy, double ixy,
151  Distortion & distortion
152  );
153 
155  double ixx, double iyy, double ixy,
156  Distortion & distortion
157  );
158 
159  void assignToQuadrupole(
160  Distortion const & distortion,
161  double & ixx, double & iyy, double & ixy
162  ) const;
163 
165  Distortion const & distortion,
166  double & ixx, double & iyy, double & ixy
167  ) const;
168 
169  double _value;
170 };
171 
176 public:
177 
178  void normalize() {}
179 
180  static std::string getName() { return "LogDeterminantRadius"; }
181 
182  explicit LogDeterminantRadius(double value=0.0) : _value(value) {}
183 
184  explicit LogDeterminantRadius(DeterminantRadius const & other);
185 
186  operator double const & () const { return _value; }
187 
188  operator double & () { return _value; }
189 
190  LogDeterminantRadius & operator=(double value) { _value = value; return *this; }
191 
193 
194 private:
195 
196  template <typename T1, typename T2> friend class Separable;
197 
199  void operator=(TraceRadius const &);
201  void operator=(LogTraceRadius const &);
202 
204  double ixx, double iyy, double ixy,
205  Distortion & distortion
206  );
207 
209  double ixx, double iyy, double ixy,
210  Distortion & distortion
211  );
212 
213  void assignToQuadrupole(
214  Distortion const & distortion,
215  double & ixx, double & iyy, double & ixy
216  ) const;
217 
219  Distortion const & distortion,
220  double & ixx, double & iyy, double & ixy
221  ) const;
222 
223  double _value;
224 };
225 
230 public:
231 
232  void normalize() {}
233 
234  static std::string getName() { return "LogTraceRadius"; }
235 
236  explicit LogTraceRadius(double value=0.0) : _value(value) {}
237 
238  explicit LogTraceRadius(TraceRadius const & other);
239 
240  operator double const & () const { return _value; }
241 
242  operator double & () { return _value; }
243 
244  LogTraceRadius & operator=(double value) { _value = value; return *this; }
245 
246  LogTraceRadius & operator=(TraceRadius const & value);
247 
248 private:
249 
250  template <typename T1, typename T2> friend class Separable;
251 
253  void operator=(DeterminantRadius const &);
255  void operator=(LogDeterminantRadius const &);
256 
258  double ixx, double iyy, double ixy,
259  Distortion & distortion
260  );
261 
263  double ixx, double iyy, double ixy,
264  Distortion & distortion
265  );
266 
267  void assignToQuadrupole(
268  Distortion const & distortion,
269  double & ixx, double & iyy, double & ixy
270  ) const;
271 
273  Distortion const & distortion,
274  double & ixx, double & iyy, double & ixy
275  ) const;
276 
277  double _value;
278 };
279 
280 inline DeterminantRadius::DeterminantRadius(LogDeterminantRadius const & other) : _value(std::exp(other)) {}
281 inline TraceRadius::TraceRadius(LogTraceRadius const & other) : _value(std::exp(other)) {}
283 inline LogTraceRadius::LogTraceRadius(TraceRadius const & other) : _value(std::log(other)) {}
284 
286  _value = std::exp(other);
287  return *this;
288 }
289 
291  _value = std::exp(other);
292  return *this;
293 }
294 
296  _value = std::log(other);
297  return *this;
298 }
299 
301  _value = std::log(other);
302  return *this;
303 }
304 
305 }}}} // namespace lsst::afw::geom::ellipses
306 
307 #endif // !LSST_AFW_GEOM_ELLIPSES_radii_h_INCLUDED
The natural logarithm of the TraceRadius.
Definition: radii.h:229
static std::string getName()
Definition: radii.h:126
void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
LogTraceRadius & operator=(double value)
Definition: radii.h:244
void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
static std::string getName()
Definition: radii.h:66
void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
LogTraceRadius(double value=0.0)
Definition: radii.h:236
float _value
Definition: saturated.cc:31
BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
def log
Definition: log.py:85
The natural logarithm of the DeterminantRadius.
Definition: radii.h:175
BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
LogDeterminantRadius & operator=(double value)
Definition: radii.h:190
BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
TraceRadius(double value=1.0)
Definition: radii.h:128
DeterminantRadius & operator=(double value)
Definition: radii.h:76
BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
Forward declarations, typedefs, and definitions for BaseCore.
void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
TraceRadius & operator=(double value)
Definition: radii.h:136
void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
The radius defined as the 4th root of the determinant of the quadrupole matrix.
Definition: radii.h:57
BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
DeterminantRadius(double value=1.0)
Definition: radii.h:68
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
The radius defined as .
Definition: radii.h:117
An ellipse core with a complex ellipticity and radius parameterization.
Definition: radii.h:43
static std::string getName()
Definition: radii.h:234
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
Definition: BaseCore.h:67
void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const
A complex ellipticity with magnitude .
Definition: Distortion.h:41
void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)
void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion)