LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Classes | Public Types | Public Member Functions | List of all members
lsst::afw::geom::ellipses::Ellipse Class Reference

An ellipse defined by an arbitrary BaseCore and a center point. More...

#include <Ellipse.h>

Classes

class  GridTransform
 A temporary-only expression object representing an lsst::geom::AffineTransform that maps the Ellipse to a unit circle at the origin. More...
 
class  Transformer
 A temporary-only expression object for ellipse transformations. More...
 

Public Types

enum  ParameterEnum { X = 3, Y = 4 }
 
typedef Eigen::Matrix< double, 5, 1 > ParameterVector
 Proxy return type for Ellipse::convolve(). More...
 

Public Member Functions

lsst::geom::Point2D const & getCenter () const
 Return the center point. More...
 
lsst::geom::Point2DgetCenter ()
 Return the center point. More...
 
void setCenter (lsst::geom::Point2D const &center)
 Set the center point. More...
 
BaseCore const & getCore () const
 Return the ellipse core. More...
 
BaseCoregetCore ()
 Return the ellipse core. More...
 
std::shared_ptr< BaseCore const > getCorePtr () const
 Return the ellipse core. More...
 
std::shared_ptr< BaseCoregetCorePtr ()
 Return the ellipse core. More...
 
void setCore (BaseCore const &core)
 Set the ellipse core; the type of the core is not changed. More...
 
void normalize ()
 Put the parameters in a standard form. More...
 
void grow (double buffer)
 Increase the major and minor radii of the ellipse by the given buffer. More...
 
void scale (double factor)
 Scale the size of the ellipse by the given factor. More...
 
void shift (lsst::geom::Extent2D const &offset)
 Move the ellipse center by the given offset. More...
 
ParameterVector const getParameterVector () const
 Return the ellipse parameters as a vector. More...
 
void setParameterVector (ParameterVector const &vector)
 Set the ellipse parameters from a vector. More...
 
void readParameters (double const *iter)
 
void writeParameters (double *iter) const
 
Coordinate transforms

These member functions transform the ellipse by the given lsst::geom::AffineTransform.

The transform can be done in-place by calling inPlace() on the returned expression object, or returned as a new shared_ptr by calling copy().

Transformer transform (lsst::geom::AffineTransform const &transform)
 
Transformer const transform (lsst::geom::AffineTransform const &transform) const
 

Convolve two bivariate Gaussians defined by their 1-sigma ellipses.

Convolution convolve (Ellipse const &other)
 Return the transform that maps the ellipse to the unit circle. More...
 
Convolution const convolve (Ellipse const &other) const
 Return the transform that maps the ellipse to the unit circle. More...
 
GridTransform const getGridTransform () const
 Return the transform that maps the ellipse to the unit circle. More...
 
lsst::geom::Box2D computeBBox () const
 Return the bounding box of the ellipse. More...
 
Ellipseoperator= (Ellipse const &other)
 Set the parameters of this ellipse from another. More...
 
Ellipseoperator= (Ellipse &&other)
 Return the transform that maps the ellipse to the unit circle. More...
 
bool operator== (Ellipse const &other) const
 Compare two ellipses for equality. More...
 
bool operator!= (Ellipse const &other) const
 Compare two ellipses for inequality. More...
 
virtual ~Ellipse ()=default
 Return the transform that maps the ellipse to the unit circle. More...
 
 Ellipse (BaseCore const &core, lsst::geom::Point2D const &center=lsst::geom::Point2D())
 Return the transform that maps the ellipse to the unit circle. More...
 
 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. More...
 
 Ellipse (Transformer const &other)
 Return the transform that maps the ellipse to the unit circle. More...
 
 Ellipse (Convolution const &other)
 Return the transform that maps the ellipse to the unit circle. More...
 
 Ellipse (Ellipse const &other)
 Return the transform that maps the ellipse to the unit circle. More...
 
 Ellipse (Ellipse &&other)
 Return the transform that maps the ellipse to the unit circle. More...
 

Detailed Description

An ellipse defined by an arbitrary BaseCore and a center point.

An ellipse is composed of its center coordinate and its Core - a parametrization of the ellipticity and size of the ellipse. Setting the core of an ellipse never changes the type of the contained core, it merely sets the parameters of that core by converting the parameters.

Definition at line 51 of file Ellipse.h.

Member Typedef Documentation

◆ ParameterVector

typedef Eigen::Matrix<double, 5, 1> lsst::afw::geom::ellipses::Ellipse::ParameterVector

Proxy return type for Ellipse::convolve().

Parameter vector type.

Definition at line 57 of file Ellipse.h.

Member Enumeration Documentation

◆ ParameterEnum

Enumerator

Definition at line 59 of file Ellipse.h.

59 { X = 3, Y = 4 };

Constructor & Destructor Documentation

◆ ~Ellipse()

virtual lsst::afw::geom::ellipses::Ellipse::~Ellipse ( )
virtualdefault

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

◆ Ellipse() [1/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( BaseCore const &  core,
lsst::geom::Point2D const &  center = lsst::geom::Point2D() 
)
inlineexplicit

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 164 of file Ellipse.h.

165  : _core(core.clone()), _center(center) {}

◆ Ellipse() [2/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( std::shared_ptr< BaseCore const > const &  core,
lsst::geom::Point2D const &  center = lsst::geom::Point2D() 
)
inlineexplicit

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 167 of file Ellipse.h.

169  : _core(core->clone()), _center(center) {}

◆ Ellipse() [3/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( Ellipse::Transformer const &  other)
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 132 of file Transformer.h.

133  : _core(other.input.getCore().transform(other.transform.getLinear()).copy()),
134  _center(other.transform(other.input.getCenter())) {}

◆ Ellipse() [4/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( Convolution const &  other)

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 75 of file Convolution.cc.

76  : _core(convolution.self.getCore().convolve(convolution.other.getCore()).copy()),
77  _center(convolution.self.getCenter() + lsst::geom::Extent2D(convolution.other.getCenter())) {}

◆ Ellipse() [5/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( Ellipse const &  other)
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 174 of file Ellipse.h.

174 : _core(other.getCore().clone()), _center(other.getCenter()) {}

◆ Ellipse() [6/6]

lsst::afw::geom::ellipses::Ellipse::Ellipse ( Ellipse &&  other)
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 176 of file Ellipse.h.

176 : Ellipse(other) {}

Member Function Documentation

◆ computeBBox()

lsst::geom::Box2D lsst::afw::geom::ellipses::Ellipse::computeBBox ( ) const

Return the bounding box of the ellipse.

Definition at line 55 of file Ellipse.cc.

◆ convolve() [1/2]

Ellipse::Convolution lsst::afw::geom::ellipses::Ellipse::convolve ( Ellipse const &  other)
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 101 of file Convolution.h.

101  {
102  return Ellipse::Convolution(*this, other);
103 }

◆ convolve() [2/2]

Ellipse::Convolution const lsst::afw::geom::ellipses::Ellipse::convolve ( Ellipse const &  other) const
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 105 of file Convolution.h.

105  {
106  return Ellipse::Convolution(const_cast<Ellipse &>(*this), other);
107 }

◆ getCenter() [1/2]

lsst::geom::Point2D& lsst::afw::geom::ellipses::Ellipse::getCenter ( )
inline

Return the center point.

Definition at line 65 of file Ellipse.h.

65 { return _center; }

◆ getCenter() [2/2]

lsst::geom::Point2D const& lsst::afw::geom::ellipses::Ellipse::getCenter ( ) const
inline

Return the center point.

Definition at line 62 of file Ellipse.h.

62 { return _center; }

◆ getCore() [1/2]

BaseCore& lsst::afw::geom::ellipses::Ellipse::getCore ( )
inline

Return the ellipse core.

Definition at line 74 of file Ellipse.h.

74 { return *_core; }

◆ getCore() [2/2]

BaseCore const& lsst::afw::geom::ellipses::Ellipse::getCore ( ) const
inline

Return the ellipse core.

Definition at line 71 of file Ellipse.h.

71 { return *_core; }

◆ getCorePtr() [1/2]

std::shared_ptr<BaseCore> lsst::afw::geom::ellipses::Ellipse::getCorePtr ( )
inline

Return the ellipse core.

Definition at line 80 of file Ellipse.h.

80 { return _core; }

◆ getCorePtr() [2/2]

std::shared_ptr<BaseCore const> lsst::afw::geom::ellipses::Ellipse::getCorePtr ( ) const
inline

Return the ellipse core.

Definition at line 77 of file Ellipse.h.

77 { return _core; }

◆ getGridTransform()

Ellipse::GridTransform const lsst::afw::geom::ellipses::Ellipse::getGridTransform ( ) const
inline

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 124 of file GridTransform.h.

124  {
125  return Ellipse::GridTransform(*this);
126 }

◆ getParameterVector()

Ellipse::ParameterVector const lsst::afw::geom::ellipses::Ellipse::getParameterVector ( ) const

Return the ellipse parameters as a vector.

Definition at line 31 of file Ellipse.cc.

31  {
33  r.head<3>() = _core->getParameterVector();
34  r.tail<2>() = _center.asEigen();
35  return r;
36 }

◆ grow()

void lsst::afw::geom::ellipses::Ellipse::grow ( double  buffer)
inline

Increase the major and minor radii of the ellipse by the given buffer.

Definition at line 89 of file Ellipse.h.

89 { _core->grow(buffer); }

◆ normalize()

void lsst::afw::geom::ellipses::Ellipse::normalize ( )
inline

Put the parameters in a standard form.

Definition at line 86 of file Ellipse.h.

86 { _core->normalize(); }

◆ operator!=()

bool lsst::afw::geom::ellipses::Ellipse::operator!= ( Ellipse const &  other) const
inline

Compare two ellipses for inequality.

Ellipses are only equal if they have the same Core types.

Definition at line 160 of file Ellipse.h.

160 { return !operator==(other); }

◆ operator=() [1/2]

Ellipse & lsst::afw::geom::ellipses::Ellipse::operator= ( Ellipse &&  other)

Return the transform that maps the ellipse to the unit circle.

The returned proxy object is implicitly convertible to lsst::geom::AffineTransform and also supports differentiation.

Definition at line 66 of file Ellipse.cc.

66 { return *this = other; }

◆ operator=() [2/2]

Ellipse & lsst::afw::geom::ellipses::Ellipse::operator= ( Ellipse const &  other)

Set the parameters of this ellipse from another.

This does not change the parametrization of the ellipse.

Definition at line 60 of file Ellipse.cc.

60  {
61  _center = other.getCenter();
62  *_core = other.getCore();
63  return *this;
64 }

◆ operator==()

bool lsst::afw::geom::ellipses::Ellipse::operator== ( Ellipse const &  other) const
inline

Compare two ellipses for equality.

Ellipses are only equal if they have the same Core types.

Definition at line 151 of file Ellipse.h.

151  {
152  return getCenter() == other.getCenter() && getCore() == other.getCore();
153  }

◆ readParameters()

void lsst::afw::geom::ellipses::Ellipse::readParameters ( double const *  iter)

Definition at line 43 of file Ellipse.cc.

43  {
44  _core->readParameters(iter);
45  _center.setX(iter[3]);
46  _center.setY(iter[4]);
47 }

◆ scale()

void lsst::afw::geom::ellipses::Ellipse::scale ( double  factor)
inline

Scale the size of the ellipse by the given factor.

Definition at line 92 of file Ellipse.h.

92 { _core->scale(factor); }

◆ setCenter()

void lsst::afw::geom::ellipses::Ellipse::setCenter ( lsst::geom::Point2D const &  center)
inline

Set the center point.

Definition at line 68 of file Ellipse.h.

68 { _center = center; }

◆ setCore()

void lsst::afw::geom::ellipses::Ellipse::setCore ( BaseCore const &  core)
inline

Set the ellipse core; the type of the core is not changed.

Definition at line 83 of file Ellipse.h.

83 { *_core = core; }

◆ setParameterVector()

void lsst::afw::geom::ellipses::Ellipse::setParameterVector ( Ellipse::ParameterVector const &  vector)

Set the ellipse parameters from a vector.

Definition at line 38 of file Ellipse.cc.

38  {
39  _core->setParameterVector(vector.head<3>());
40  _center = lsst::geom::Point2D(vector.tail<2>());
41 }

◆ shift()

void lsst::afw::geom::ellipses::Ellipse::shift ( lsst::geom::Extent2D const &  offset)
inline

Move the ellipse center by the given offset.

Definition at line 95 of file Ellipse.h.

95 { _center += offset; }

◆ transform() [1/2]

Ellipse::Transformer lsst::afw::geom::ellipses::Ellipse::transform ( lsst::geom::AffineTransform const &  transform)
inline

Definition at line 124 of file Transformer.h.

124  {
125  return Ellipse::Transformer(*this, transform);
126 }

◆ transform() [2/2]

Ellipse::Transformer const lsst::afw::geom::ellipses::Ellipse::transform ( lsst::geom::AffineTransform const &  transform) const
inline

Definition at line 128 of file Transformer.h.

128  {
129  return Ellipse::Transformer(const_cast<Ellipse &>(*this), transform);
130 }

◆ writeParameters()

void lsst::afw::geom::ellipses::Ellipse::writeParameters ( double *  iter) const

Definition at line 49 of file Ellipse.cc.

49  {
50  _core->writeParameters(iter);
51  iter[3] = _center.getX();
52  iter[4] = _center.getY();
53 }

The documentation for this class was generated from the following files:
lsst::afw::geom::ellipses::Ellipse::Y
@ Y
Definition: Ellipse.h:59
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::BaseCore::computeDimensions
lsst::geom::Extent2D computeDimensions() const
Return the size of the bounding box for the ellipse core.
Definition: BaseCore.cc:130
lsst::geom::Point2D
Point< double, 2 > Point2D
Definition: Point.h:324
lsst::afw::geom::ellipses::Ellipse::transform
Transformer transform(lsst::geom::AffineTransform const &transform)
Definition: Transformer.h:124
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
dimensions
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
lsst::afw::geom::ellipses::Ellipse::X
@ X
Definition: Ellipse.h:59
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::geom::Extent< double, 2 >
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88
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