LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
Quadrupole.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_Quadrupole_h_INCLUDED
26 #define LSST_AFW_GEOM_ELLIPSES_Quadrupole_h_INCLUDED
27 
39 
40 namespace lsst { namespace afw { namespace geom { namespace ellipses {
41 
45 class Quadrupole : public BaseCore {
46 public:
47 
48  typedef std::shared_ptr<Quadrupole> Ptr;
49  typedef std::shared_ptr<Quadrupole const> ConstPtr;
50 
51  enum ParameterEnum { IXX=0, IYY=1, IXY=2 };
52 
54  typedef Eigen::Matrix<double,2,2,Eigen::DontAlign> Matrix;
55 
56  double const getIxx() const { return _matrix(0, 0); }
57  void setIxx(double ixx) { _matrix(0, 0) = ixx; }
58 
59  double const getIyy() const { return _matrix(1, 1); }
60  void setIyy(double iyy) { _matrix(1, 1) = iyy; }
61 
62  double const getIxy() const { return _matrix(1, 0); }
63  void setIxy(double ixy) { _matrix(0, 1) = _matrix(1, 0) = ixy; }
64 
66  Ptr clone() const { return std::static_pointer_cast<Quadrupole>(_clone()); }
67 
69  virtual std::string getName() const;
70 
75  virtual void normalize();
76 
77  virtual void readParameters(double const * iter);
78 
79  virtual void writeParameters(double * iter) const;
80 
82  Matrix const & getMatrix() const { return _matrix; }
83 
85  double getDeterminant() const { return getIxx() * getIyy() - getIxy() * getIxy(); }
86 
88  Quadrupole & operator=(Quadrupole const & other) { _matrix = other._matrix; return *this; }
89 
91  Quadrupole & operator=(BaseCore const & other) { BaseCore::operator=(other); return *this; }
92 
94  explicit Quadrupole(double ixx=1.0, double iyy=1.0, double ixy=0.0, bool normalize=false);
95 
97  explicit Quadrupole(BaseCore::ParameterVector const & vector, bool normalize=false);
98 
100  explicit Quadrupole(Matrix const & matrix, bool normalize=true);
101 
103  Quadrupole(Quadrupole const & other) : _matrix(other._matrix) {}
104 
106  Quadrupole(BaseCore const & other) { *this = other; }
107 #ifndef SWIG
108  Quadrupole(BaseCore::Transformer const & transformer) {
110  transformer.apply(*this);
111  }
112 
114  Quadrupole(BaseCore::Convolution const & convolution) {
115  convolution.apply(*this);
116  }
117 #endif
118 protected:
119 
120  virtual BaseCore::Ptr _clone() const { return std::make_shared<Quadrupole>(*this); }
121 
122  virtual void _assignToQuadrupole(double & ixx, double & iyy, double & ixy) const;
123  virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy);
124 
125  virtual void _assignToAxes(double & a, double & b, double & theta) const;
126  virtual void _assignFromAxes(double a, double b, double theta);
127 
128  virtual Jacobian _dAssignToQuadrupole(double & ixx, double & iyy, double & ixy) const;
129  virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy);
130 
131  virtual Jacobian _dAssignToAxes(double & a, double & b, double & theta) const;
132  virtual Jacobian _dAssignFromAxes(double a, double b, double theta);
133 
134 private:
135  static Registrar<Quadrupole> registrar;
136 
138 };
139 
140 }}}} // namespace lsst::afw::geom::ellipses
141 
142 #endif // !LSST_AFW_GEOM_ELLIPSES_Quadrupole_h_INCLUDED
int iter
An ellipse core with quadrupole moments as parameters.
Definition: Quadrupole.h:45
A temporary-only expression object for ellipse core transformations.
Definition: Transformer.h:47
Definitions for Ellipse::Transformer and BaseCore::Transformer.
Quadrupole & operator=(Quadrupole const &other)
Standard assignment.
Definition: Quadrupole.h:88
Quadrupole & operator=(BaseCore const &other)
Converting assignment.
Definition: Quadrupole.h:91
Quadrupole(BaseCore::Convolution const &convolution)
Converting copy constructor.
Definition: Quadrupole.h:114
Definitions for BaseEllipse::Convolution and BaseCore::Convolution.
std::shared_ptr< BaseCore > Ptr
Definition: BaseCore.h:59
Eigen::Vector3d ParameterVector
Parameter vector type.
Definition: BaseCore.h:65
double const getIyy() const
Definition: Quadrupole.h:59
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
Definition: BaseCore.h:66
virtual Jacobian _dAssignFromAxes(double a, double b, double theta)
static Registrar< Quadrupole > registrar
Definition: Quadrupole.h:135
virtual void normalize()
Put the parameters into a &quot;standard form&quot;, and throw InvalidParameterError if they cannot be normaliz...
Ptr clone() const
Deep copy the ellipse core.
Definition: Quadrupole.h:66
std::shared_ptr< Quadrupole > Ptr
Definition: Quadrupole.h:48
virtual void writeParameters(double *iter) const
virtual void _assignToQuadrupole(double &ixx, double &iyy, double &ixy) const
Forward declarations, typedefs, and definitions for BaseCore.
virtual void readParameters(double const *iter)
virtual Jacobian _dAssignToAxes(double &a, double &b, double &theta) const
Quadrupole(Quadrupole const &other)
Copy constructor.
Definition: Quadrupole.h:103
Quadrupole(BaseCore const &other)
Converting copy constructor.
Definition: Quadrupole.h:106
double const getIxy() const
Definition: Quadrupole.h:62
double const getIxx() const
Definition: Quadrupole.h:56
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
Matrix type for the matrix representation of Quadrupole parameters.
Definition: Quadrupole.h:54
A base class for parametrizations of the &quot;core&quot; of an ellipse - the ellipticity and size...
Definition: BaseCore.h:53
virtual Jacobian _dAssignToQuadrupole(double &ixx, double &iyy, double &ixy) const
Matrix const & getMatrix() const
Return a 2x2 symmetric matrix of the parameters.
Definition: Quadrupole.h:82
afw::table::Key< double > b
virtual std::string getName() const
Return a string that identifies this parametrization.
virtual void _assignFromAxes(double a, double b, double theta)
double getDeterminant() const
Return the determinant of the matrix representation.
Definition: Quadrupole.h:85
virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy)
Quadrupole(double ixx=1.0, double iyy=1.0, double ixy=0.0, bool normalize=false)
Construct from parameter values.
Definitions for Ellipse::GridTransform and BaseCore::GridTransform.
virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy)
std::shared_ptr< Quadrupole const > ConstPtr
Definition: Quadrupole.h:49
A temporary-only expression object for ellipse core convolution.
Definition: Convolution.h:44
BaseCore & operator=(BaseCore const &other)
Set the parameters of this ellipse core from another.
virtual void _assignToAxes(double &a, double &b, double &theta) const
virtual BaseCore::Ptr _clone() const
Definition: Quadrupole.h:120