lsst.afw  13.0-73-gb2a4e38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
28 /*
29  * Helper classes defining radii for Separable core.
30  *
31  * Note: do not include directly; use the main ellipse header file.
32  */
33 
36 #include <complex>
37 
38 namespace lsst {
39 namespace afw {
40 namespace geom {
41 namespace ellipses {
42 
43 template <typename Ellipticity_, typename Radius_>
44 class Separable;
45 
46 class DeterminantRadius;
47 class TraceRadius;
49 class LogTraceRadius;
50 
58 public:
59  void normalize() {
60  if (_value < 0)
61  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
62  "Ellipse radius cannot be negative.");
63  }
64 
65  static std::string getName() { return "DeterminantRadius"; }
66 
67  explicit DeterminantRadius(double value = 1.0) : _value(value) {}
68 
69  explicit DeterminantRadius(LogDeterminantRadius const &other);
70 
71  operator double const &() const { return _value; }
72 
73  operator double &() { return _value; }
74 
75  DeterminantRadius &operator=(double value) {
76  _value = value;
77  return *this;
78  }
79 
81 
82 private:
83  template <typename T1, typename T2>
84  friend class Separable;
85 
87  void operator=(TraceRadius const &);
89  void operator=(LogTraceRadius const &);
90 
91  void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
92 
93  BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
94 
95  void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const;
96 
97  BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy,
98  double &ixy) const;
99 
100  double _value;
101 };
102 
108 class TraceRadius {
109 public:
110  void normalize() {
111  if (_value < 0)
112  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
113  "Ellipse radius cannot be negative.");
114  }
115 
116  static std::string getName() { return "TraceRadius"; }
117 
118  explicit TraceRadius(double value = 1.0) : _value(value) {}
119 
120  explicit TraceRadius(LogTraceRadius const &other);
121 
122  operator double const &() const { return _value; }
123 
124  operator double &() { return _value; }
125 
126  TraceRadius &operator=(double value) {
127  _value = value;
128  return *this;
129  }
130 
131  TraceRadius &operator=(LogTraceRadius const &other);
132 
133 private:
134  template <typename T1, typename T2>
135  friend class Separable;
136 
138  void operator=(DeterminantRadius const &);
140  void operator=(LogDeterminantRadius const &);
141 
142  void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
143 
144  BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
145 
146  void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const;
147 
148  BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy,
149  double &ixy) const;
150 
151  double _value;
152 };
153 
158 public:
159  void normalize() {}
160 
161  static std::string getName() { return "LogDeterminantRadius"; }
162 
163  explicit LogDeterminantRadius(double value = 0.0) : _value(value) {}
164 
165  explicit LogDeterminantRadius(DeterminantRadius const &other);
166 
167  operator double const &() const { return _value; }
168 
169  operator double &() { return _value; }
170 
172  _value = value;
173  return *this;
174  }
175 
177 
178 private:
179  template <typename T1, typename T2>
180  friend class Separable;
181 
183  void operator=(TraceRadius const &);
185  void operator=(LogTraceRadius const &);
186 
187  void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
188 
189  BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
190 
191  void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const;
192 
193  BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy,
194  double &ixy) const;
195 
196  double _value;
197 };
198 
203 public:
204  void normalize() {}
205 
206  static std::string getName() { return "LogTraceRadius"; }
207 
208  explicit LogTraceRadius(double value = 0.0) : _value(value) {}
209 
210  explicit LogTraceRadius(TraceRadius const &other);
211 
212  operator double const &() const { return _value; }
213 
214  operator double &() { return _value; }
215 
216  LogTraceRadius &operator=(double value) {
217  _value = value;
218  return *this;
219  }
220 
221  LogTraceRadius &operator=(TraceRadius const &value);
222 
223 private:
224  template <typename T1, typename T2>
225  friend class Separable;
226 
228  void operator=(DeterminantRadius const &);
230  void operator=(LogDeterminantRadius const &);
231 
232  void assignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
233 
234  BaseCore::Jacobian dAssignFromQuadrupole(double ixx, double iyy, double ixy, Distortion &distortion);
235 
236  void assignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy, double &ixy) const;
237 
238  BaseCore::Jacobian dAssignToQuadrupole(Distortion const &distortion, double &ixx, double &iyy,
239  double &ixy) const;
240 
241  double _value;
242 };
243 
244 inline DeterminantRadius::DeterminantRadius(LogDeterminantRadius const &other) : _value(std::exp(other)) {}
245 inline TraceRadius::TraceRadius(LogTraceRadius const &other) : _value(std::exp(other)) {}
246 inline LogDeterminantRadius::LogDeterminantRadius(DeterminantRadius const &other) : _value(std::log(other)) {}
247 inline LogTraceRadius::LogTraceRadius(TraceRadius const &other) : _value(std::log(other)) {}
248 
250  _value = std::exp(other);
251  return *this;
252 }
253 
255  _value = std::exp(other);
256  return *this;
257 }
258 
260  _value = std::log(other);
261  return *this;
262 }
263 
265  _value = std::log(other);
266  return *this;
267 }
268 }
269 }
270 }
271 } // namespace lsst::afw::geom::ellipses
272 
273 #endif // !LSST_AFW_GEOM_ELLIPSES_radii_h_INCLUDED
The natural logarithm of the TraceRadius.
Definition: radii.h:202
float _value
Definition: saturated.cc:25
TraceRadius & operator=(double value)
Definition: radii.h:126
LogTraceRadius & operator=(double value)
Definition: radii.h:216
The natural logarithm of the DeterminantRadius.
Definition: radii.h:157
The radius defined as the 4th root of the determinant of the quadrupole matrix.
Definition: radii.h:57
DeterminantRadius & operator=(double value)
Definition: radii.h:75
The radius defined as .
Definition: radii.h:108
An ellipse core with a complex ellipticity and radius parameterization.
Definition: radii.h:44
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
Definition: BaseCore.h:64
static std::string getName()
Definition: radii.h:116
LogDeterminantRadius & operator=(double value)
Definition: radii.h:171
A complex ellipticity with magnitude .
Definition: Distortion.h:44