LSSTApplications  21.0.0+75b29a8a7f,21.0.0+e70536a077,21.0.0-1-ga51b5d4+62c747d40b,21.0.0-11-ga6ea59e8e+47cba9fc36,21.0.0-2-g103fe59+914993bf7c,21.0.0-2-g1367e85+e2614ded12,21.0.0-2-g45278ab+e70536a077,21.0.0-2-g4bc9b9f+7b2b5f8678,21.0.0-2-g5242d73+e2614ded12,21.0.0-2-g54e2caa+6403186824,21.0.0-2-g7f82c8f+3ac4acbffc,21.0.0-2-g8dde007+04a6aea1af,21.0.0-2-g8f08a60+9402881886,21.0.0-2-ga326454+3ac4acbffc,21.0.0-2-ga63a54e+81dd751046,21.0.0-2-gc738bc1+5f65c6e7a9,21.0.0-2-gde069b7+26c92b3210,21.0.0-2-gecfae73+0993ddc9bd,21.0.0-2-gfc62afb+e2614ded12,21.0.0-21-gba890a8+5a4f502a26,21.0.0-23-g9966ff26+03098d1af8,21.0.0-3-g357aad2+8ad216c477,21.0.0-3-g4be5c26+e2614ded12,21.0.0-3-g6d51c4a+4d2fe0280d,21.0.0-3-g7d9da8d+75b29a8a7f,21.0.0-3-gaa929c8+522e0f12c2,21.0.0-3-ge02ed75+4d2fe0280d,21.0.0-4-g3300ddd+e70536a077,21.0.0-4-gc004bbf+eac6615e82,21.0.0-4-gccdca77+f94adcd104,21.0.0-4-gd1c1571+18b81799f9,21.0.0-5-g7b47fff+4d2fe0280d,21.0.0-5-gb155db7+d2632f662b,21.0.0-5-gdf36809+637e4641ee,21.0.0-6-g722ad07+28c848f42a,21.0.0-7-g959bb79+522e0f12c2,21.0.0-7-gfd72ab2+cf01990774,21.0.0-9-g87fb7b8d+e2ab11cdd6,w.2021.04
LSSTDataManagementBasePackage
Ellipse.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_Ellipse_h_INCLUDED
26 #define LSST_AFW_GEOM_ELLIPSES_Ellipse_h_INCLUDED
27 
28 /*
29  * Forward declarations, typedefs, and definitions for Ellipse.
30  *
31  * Note: do not include directly; use the main ellipse header file.
32  */
33 
35 #include "lsst/geom/Box.h"
37 
38 namespace lsst {
39 namespace afw {
40 namespace geom {
41 namespace ellipses {
42 
51 class Ellipse {
52 public:
53  class Transformer;
54  class GridTransform;
55  class Convolution;
56 
57  typedef Eigen::Matrix<double, 5, 1> ParameterVector;
58 
59  enum ParameterEnum { X = 3, Y = 4 };
60 
62  lsst::geom::Point2D const& getCenter() const { return _center; }
63 
65  lsst::geom::Point2D& getCenter() { return _center; }
66 
68  void setCenter(lsst::geom::Point2D const& center) { _center = center; }
69 
71  BaseCore const& getCore() const { return *_core; }
72 
74  BaseCore& getCore() { return *_core; }
75 
77  std::shared_ptr<BaseCore const> getCorePtr() const { return _core; }
78 
81 
83  void setCore(BaseCore const& core) { *_core = core; }
84 
86  void normalize() { _core->normalize(); }
87 
89  void grow(double buffer) { _core->grow(buffer); }
90 
92  void scale(double factor) { _core->scale(factor); }
93 
95  void shift(lsst::geom::Extent2D const& offset) { _center += offset; }
96 
98  ParameterVector const getParameterVector() const;
99 
101  void setParameterVector(ParameterVector const& vector);
102 
103  void readParameters(double const* iter);
104 
105  void writeParameters(double* iter) const;
106 
115  Transformer transform(lsst::geom::AffineTransform const& transform);
116  Transformer const transform(lsst::geom::AffineTransform const& transform) const;
118 
123  Convolution convolve(Ellipse const& other);
124  Convolution const convolve(Ellipse const& other) const;
126 
133  GridTransform const getGridTransform() const;
134 
137 
143  Ellipse& operator=(Ellipse const& other);
145 
151  bool operator==(Ellipse const& other) const {
152  return getCenter() == other.getCenter() && getCore() == other.getCore();
153  }
154 
160  bool operator!=(Ellipse const& other) const { return !operator==(other); }
161 
162  virtual ~Ellipse() = default;
163 
164  explicit Ellipse(BaseCore const& core, lsst::geom::Point2D const& center = lsst::geom::Point2D())
165  : _core(core.clone()), _center(center) {}
166 
168  lsst::geom::Point2D const& center = lsst::geom::Point2D())
169  : _core(core->clone()), _center(center) {}
170 
171  Ellipse(Transformer const& other);
172  Ellipse(Convolution const& other);
173 
174  Ellipse(Ellipse const& other) : _core(other.getCore().clone()), _center(other.getCenter()) {}
175  // Delegate to copy-constructor for backwards compatibility
177 
178 private:
180  lsst::geom::Point2D _center;
181 };
182 } // namespace ellipses
183 } // namespace geom
184 } // namespace afw
185 } // namespace lsst
186 
187 #endif // !LSST_AFW_GEOM_ELLIPSES_Ellipse_h_INCLUDED
lsst::afw::geom::ellipses::Ellipse::convolve
Convolution convolve(Ellipse const &other)
Return the transform that maps the ellipse to the unit circle.
Definition: Convolution.h:101
std::shared_ptr
STL class.
lsst::afw::geom::ellipses::Ellipse::Y
@ Y
Definition: Ellipse.h:59
ellipses
lsst::afw::geom::ellipses::Ellipse::ParameterVector
Eigen::Matrix< double, 5, 1 > ParameterVector
Proxy return type for Ellipse::convolve().
Definition: Ellipse.h:55
lsst::afw::geom::ellipses::Ellipse::operator==
bool operator==(Ellipse const &other) const
Compare two ellipses for equality.
Definition: Ellipse.h:151
lsst::afw::geom::ellipses::Ellipse::Ellipse
Ellipse(std::shared_ptr< BaseCore const > const &core, lsst::geom::Point2D const &center=lsst::geom::Point2D())
Return the transform that maps the ellipse to the unit circle.
Definition: Ellipse.h:167
lsst::afw::geom::ellipses::Ellipse::normalize
void normalize()
Put the parameters in a standard form.
Definition: Ellipse.h:86
lsst::afw::geom::ellipses::Ellipse::computeBBox
lsst::geom::Box2D computeBBox() const
Return the bounding box of the ellipse.
Definition: Ellipse.cc:55
AffineTransform.h
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::geom::ellipses::Ellipse::operator=
Ellipse & operator=(Ellipse const &other)
Set the parameters of this ellipse from another.
Definition: Ellipse.cc:60
lsst::afw::geom::ellipses::Ellipse::getCorePtr
std::shared_ptr< BaseCore > getCorePtr()
Return the ellipse core.
Definition: Ellipse.h:80
lsst::afw::geom::ellipses::Ellipse::Ellipse
Ellipse(Ellipse const &other)
Return the transform that maps the ellipse to the unit circle.
Definition: Ellipse.h:174
lsst::afw::geom::ellipses::Ellipse::getCorePtr
std::shared_ptr< BaseCore const > getCorePtr() const
Return the ellipse core.
Definition: Ellipse.h:77
lsst::afw::geom::ellipses::Ellipse::getCenter
lsst::geom::Point2D & getCenter()
Return the center point.
Definition: Ellipse.h:65
lsst::geom::AffineTransform
An affine coordinate transformation consisting of a linear transformation and an offset.
Definition: AffineTransform.h:75
lsst::afw::geom::ellipses::Ellipse::shift
void shift(lsst::geom::Extent2D const &offset)
Move the ellipse center by the given offset.
Definition: Ellipse.h:95
lsst::afw::geom::ellipses::Ellipse::setCenter
void setCenter(lsst::geom::Point2D const &center)
Set the center point.
Definition: Ellipse.h:68
lsst::afw::geom::ellipses::Ellipse::setCore
void setCore(BaseCore const &core)
Set the ellipse core; the type of the core is not changed.
Definition: Ellipse.h:83
lsst::afw::geom::ellipses::Ellipse::Transformer
A temporary-only expression object for ellipse transformations.
Definition: Transformer.h:86
lsst::afw::geom::ellipses::BaseCore
A base class for parametrizations of the "core" of an ellipse - the ellipticity and size.
Definition: BaseCore.h:55
lsst::afw::geom::ellipses::Ellipse::transform
Transformer transform(lsst::geom::AffineTransform const &transform)
Definition: Transformer.h:124
lsst::afw::geom::ellipses::Ellipse::~Ellipse
virtual ~Ellipse()=default
Return the transform that maps the ellipse to the unit circle.
lsst::afw::geom::ellipses::Ellipse::getCenter
lsst::geom::Point2D const & getCenter() const
Return the center point.
Definition: Ellipse.h:62
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::geom::ellipses::Ellipse::getCore
BaseCore & getCore()
Return the ellipse core.
Definition: Ellipse.h:74
lsst::afw::geom::ellipses::Ellipse::GridTransform
A temporary-only expression object representing an lsst::geom::AffineTransform that maps the Ellipse ...
Definition: GridTransform.h:82
lsst::afw::geom::ellipses::Ellipse::readParameters
void readParameters(double const *iter)
Definition: Ellipse.cc:43
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::afw::geom::ellipses::Ellipse::writeParameters
void writeParameters(double *iter) const
Definition: Ellipse.cc:49
lsst::afw::geom::ellipses::Ellipse
An ellipse defined by an arbitrary BaseCore and a center point.
Definition: Ellipse.h:51
lsst::afw::geom::ellipses::Ellipse::X
@ X
Definition: Ellipse.h:59
lsst::geom
Definition: AffineTransform.h:36
lsst::afw::geom::ellipses::Ellipse::grow
void grow(double buffer)
Increase the major and minor radii of the ellipse by the given buffer.
Definition: Ellipse.h:89
lsst::geom::Point< double, 2 >
lsst::afw::geom::ellipses::Ellipse::Ellipse
Ellipse(Ellipse &&other)
Return the transform that maps the ellipse to the unit circle.
Definition: Ellipse.h:176
lsst::afw::geom::ellipses::Ellipse::setParameterVector
void setParameterVector(ParameterVector const &vector)
Set the ellipse parameters from a vector.
Definition: Ellipse.cc:38
lsst::afw::geom::ellipses::Ellipse::getCore
BaseCore const & getCore() const
Return the ellipse core.
Definition: Ellipse.h:71
lsst::geom::Box2D
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
lsst::afw::geom::ellipses::Ellipse::getGridTransform
GridTransform const getGridTransform() const
Return the transform that maps the ellipse to the unit circle.
Definition: GridTransform.h:114
lsst::afw::geom::ellipses::Ellipse::getParameterVector
ParameterVector const getParameterVector() const
Return the ellipse parameters as a vector.
Definition: Ellipse.cc:31
lsst::afw::image.slicing.clone
clone
Definition: slicing.py:257
lsst::geom::Extent< double, 2 >
lsst::afw::geom::ellipses::Ellipse::scale
void scale(double factor)
Scale the size of the ellipse by the given factor.
Definition: Ellipse.h:92
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88
lsst::afw::geom::ellipses::Ellipse::operator!=
bool operator!=(Ellipse const &other) const
Compare two ellipses for inequality.
Definition: Ellipse.h:160
Box.h
BaseCore.h
lsst::afw::geom::ellipses::Ellipse::ParameterEnum
ParameterEnum
Definition: Ellipse.h:59
lsst::afw::geom::ellipses::Ellipse::Ellipse
Ellipse(BaseCore const &core, lsst::geom::Point2D const &center=lsst::geom::Point2D())
Return the transform that maps the ellipse to the unit circle.
Definition: Ellipse.h:164