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
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 boost::shared_ptr<Quadrupole> Ptr;
49  typedef boost::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 boost::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 boost::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
virtual void readParameters(double const *iter)
An ellipse core with quadrupole moments as parameters.
Definition: Quadrupole.h:45
Quadrupole & operator=(Quadrupole const &other)
Standard assignment.
Definition: Quadrupole.h:88
boost::shared_ptr< BaseCore > Ptr
Definition: BaseCore.h:60
A temporary-only expression object for ellipse core transformations.
Definition: Transformer.h:47
Definitions for Ellipse::Transformer and BaseCore::Transformer.
virtual void _assignToAxes(double &a, double &b, double &theta) const
boost::shared_ptr< Quadrupole const > ConstPtr
Definition: Quadrupole.h:49
Definitions for BaseEllipse::Convolution and BaseCore::Convolution.
Quadrupole(BaseCore const &other)
Converting copy constructor.
Definition: Quadrupole.h:106
virtual void _assignFromAxes(double a, double b, double theta)
Ptr clone() const
Deep copy the ellipse core.
Definition: Quadrupole.h:66
virtual std::string getName() const
Return a string that identifies this parametrization.
virtual Jacobian _dAssignToAxes(double &a, double &b, double &theta) const
double const getIyy() const
Definition: Quadrupole.h:59
Quadrupole(BaseCore::Convolution const &convolution)
Converting copy constructor.
Definition: Quadrupole.h:114
Quadrupole(Quadrupole const &other)
Copy constructor.
Definition: Quadrupole.h:103
Quadrupole(double ixx=1.0, double iyy=1.0, double ixy=0.0, bool normalize=false)
Construct from parameter values.
Eigen::Vector3d ParameterVector
Parameter vector type.
Definition: BaseCore.h:66
virtual Jacobian _dAssignFromAxes(double a, double b, double theta)
void apply(BaseCore &result) const
static Registrar< Quadrupole > registrar
Definition: Quadrupole.h:135
Forward declarations, typedefs, and definitions for BaseCore.
virtual Jacobian _dAssignToQuadrupole(double &ixx, double &iyy, double &ixy) const
BaseCore & operator=(BaseCore const &other)
Set the parameters of this ellipse core from another.
double const getIxx() const
Definition: Quadrupole.h:56
virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy)
Matrix const & getMatrix() const
Return a 2x2 symmetric matrix of the parameters.
Definition: Quadrupole.h:82
void apply(BaseCore &result) const
Quadrupole & operator=(BaseCore const &other)
Converting assignment.
Definition: Quadrupole.h:91
A base class for parametrizations of the &quot;core&quot; of an ellipse - the ellipticity and size...
Definition: BaseCore.h:54
virtual BaseCore::Ptr _clone() const
Definition: Quadrupole.h:120
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
Definition: BaseCore.h:67
double getDeterminant() const
Return the determinant of the matrix representation.
Definition: Quadrupole.h:85
afw::table::Key< double > b
double const getIxy() const
Definition: Quadrupole.h:62
virtual void writeParameters(double *iter) const
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
Matrix type for the matrix representation of Quadrupole parameters.
Definition: Quadrupole.h:54
virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy)
virtual void _assignToQuadrupole(double &ixx, double &iyy, double &ixy) const
Definitions for Ellipse::GridTransform and BaseCore::GridTransform.
A temporary-only expression object for ellipse core convolution.
Definition: Convolution.h:44
virtual void normalize()
Put the parameters into a &quot;standard form&quot;, and throw InvalidEllipseParameters if they cannot be norma...
boost::shared_ptr< Quadrupole > Ptr
Definition: Quadrupole.h:48