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
Axes.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_Axes_h_INCLUDED
26 #define LSST_AFW_GEOM_ELLIPSES_Axes_h_INCLUDED
27 
39 
40 namespace lsst { namespace afw { namespace geom { namespace ellipses {
41 
45 class Axes : public BaseCore {
46 public:
47 
48  typedef boost::shared_ptr<Axes> Ptr;
49  typedef boost::shared_ptr<Axes const> ConstPtr;
50 
51  enum ParameterEnum { A=0, B=1, THETA=2 };
52 
53  double const getA() const { return _vector[A]; }
54  void setA(double a) { _vector[A] = a; }
55 
56  double const getB() const { return _vector[B]; }
57  void setB(double b) { _vector[B] = b; }
58 
59  double const getTheta() const { return _vector[THETA]; }
60  void setTheta(double theta) { _vector[THETA] = theta; }
61 
63  Ptr clone() const { return boost::static_pointer_cast<Axes>(_clone()); }
64 
66  virtual std::string getName() const;
67 
72  virtual void normalize();
73 
74  virtual void readParameters(double const * iter);
75 
76  virtual void writeParameters(double * iter) const;
77 
79  Axes & operator=(Axes const & other) { _vector = other._vector; return *this; }
80 
82  Axes & operator=(BaseCore const & other) { BaseCore::operator=(other); return *this; }
83 
85  explicit Axes(double a=1.0, double b=1.0, double theta=0.0, bool normalize=false) :
86  _vector(a, b, theta) { if (normalize) this->normalize(); }
87 
89  explicit Axes(BaseCore::ParameterVector const & vector, bool normalize=false) :
90  _vector(vector) { if (normalize) this->normalize(); }
91 
93  Axes(Axes const & other) : _vector(other._vector) {}
94 
96  Axes(BaseCore const & other) { *this = other; }
97 
98 #ifndef SWIG
99  Axes(BaseCore::Transformer const & transformer) {
101  transformer.apply(*this);
102  }
103 
105  Axes(BaseCore::Convolution const & convolution) {
106  convolution.apply(*this);
107  }
108 #endif
109 protected:
110 
111  virtual BaseCore::Ptr _clone() const { return boost::make_shared<Axes>(*this); }
112 
113  virtual void _assignToQuadrupole(double & ixx, double & iyy, double & ixy) const;
114  virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy);
115 
116  virtual void _assignToAxes(double & a, double & b, double & theta) const;
117  virtual void _assignFromAxes(double a, double b, double theta);
118 
119  virtual Jacobian _dAssignToQuadrupole(double & ixx, double & iyy, double & ixy) const;
120  virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy);
121 
122  virtual Jacobian _dAssignToAxes(double & a, double & b, double & theta) const;
123  virtual Jacobian _dAssignFromAxes(double a, double b, double theta);
124 
125 private:
126  static Registrar<Axes> registrar;
127 
129 };
130 
131 }}}} // namespace lsst::afw::geom::ellipses
132 
133 #endif // !LSST_AFW_GEOM_ELLIPSES_Axes_h_INCLUDED
int iter
boost::shared_ptr< BaseCore > Ptr
Definition: BaseCore.h:60
virtual void _assignToAxes(double &a, double &b, double &theta) const
virtual void _assignFromAxes(double a, double b, double theta)
boost::shared_ptr< Axes > Ptr
Definition: Axes.h:48
A temporary-only expression object for ellipse core transformations.
Definition: Transformer.h:47
Definitions for Ellipse::Transformer and BaseCore::Transformer.
void setTheta(double theta)
Definition: Axes.h:60
boost::shared_ptr< Axes const > ConstPtr
Definition: Axes.h:49
virtual void _assignToQuadrupole(double &ixx, double &iyy, double &ixy) const
ParameterVector _vector
Definition: Axes.h:128
Definitions for BaseEllipse::Convolution and BaseCore::Convolution.
virtual Jacobian _dAssignFromAxes(double a, double b, double theta)
void setA(double a)
Definition: Axes.h:54
virtual BaseCore::Ptr _clone() const
Definition: Axes.h:111
Axes & operator=(Axes const &other)
Standard assignment.
Definition: Axes.h:79
static Registrar< Axes > registrar
Definition: Axes.h:126
Axes(BaseCore::ParameterVector const &vector, bool normalize=false)
Construct from a parameter vector.
Definition: Axes.h:89
virtual Jacobian _dAssignToQuadrupole(double &ixx, double &iyy, double &ixy) const
Axes & operator=(BaseCore const &other)
Converting assignment.
Definition: Axes.h:82
Axes(BaseCore const &other)
Converting copy constructor.
Definition: Axes.h:96
Eigen::Vector3d ParameterVector
Parameter vector type.
Definition: BaseCore.h:66
virtual void readParameters(double const *iter)
virtual void writeParameters(double *iter) const
void apply(BaseCore &result) const
Forward declarations, typedefs, and definitions for BaseCore.
virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy)
double const getA() const
Definition: Axes.h:53
Ptr clone() const
Deep copy the ellipse core.
Definition: Axes.h:63
double const getTheta() const
Definition: Axes.h:59
BaseCore & operator=(BaseCore const &other)
Set the parameters of this ellipse core from another.
void setB(double b)
Definition: Axes.h:57
double const getB() const
Definition: Axes.h:56
void apply(BaseCore &result) const
Axes(BaseCore::Convolution const &convolution)
Converting copy constructor.
Definition: Axes.h:105
An ellipse core for the semimajor/semiminor axis and position angle parametrization (a...
Definition: Axes.h:45
Axes(Axes const &other)
Copy constructor.
Definition: Axes.h:93
A base class for parametrizations of the &quot;core&quot; of an ellipse - the ellipticity and size...
Definition: BaseCore.h:54
Axes(double a=1.0, double b=1.0, double theta=0.0, bool normalize=false)
Construct from parameter values.
Definition: Axes.h:85
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
Definition: BaseCore.h:67
afw::table::Key< double > b
virtual std::string getName() const
Return a string that identifies this parametrization.
virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy)
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;, if possible, and throw InvalidEllipseParameters if they ca...
virtual Jacobian _dAssignToAxes(double &a, double &b, double &theta) const