LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Classes | Public Member Functions | List of all members
lsst::afw::geom::ellipses::PixelRegion Class Referencefinal

#include <PixelRegion.h>

Classes

class  Iterator
 

Public Member Functions

Iterator begin () const
 
Iterator end () const
 
lsst::geom::Box2I const & getBBox () const
 
Span const getSpanAt (int y) const
 
 PixelRegion (Ellipse const &ellipse)
 
 PixelRegion (PixelRegion const &)=default
 
 PixelRegion (PixelRegion &&)=default
 
PixelRegionoperator= (PixelRegion const &)=default
 
PixelRegionoperator= (PixelRegion &&)=default
 
 ~PixelRegion ()=default
 

Detailed Description

Definition at line 38 of file PixelRegion.h.

Constructor & Destructor Documentation

◆ PixelRegion() [1/3]

lsst::afw::geom::ellipses::PixelRegion::PixelRegion ( Ellipse const &  ellipse)
explicit

Definition at line 33 of file PixelRegion.cc.

34  : _center(ellipse.getCenter()), _bbox(ellipse.computeBBox(), lsst::geom::Box2I::EXPAND) {
35  Quadrupole::Matrix q = Quadrupole(ellipse.getCore()).getMatrix();
36  _detQ = q(0, 0) * q(1, 1) - q(0, 1) * q(0, 1);
37  _invQxx = q(1, 1) / _detQ;
38  _alpha = q(0, 1) / _detQ / _invQxx; // == -invQxy / invQxx
39  if (std::isnan(_alpha)) {
40  _alpha = 0.0;
41  }
42 }
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
Matrix type for the matrix representation of Quadrupole parameters.
Definition: Quadrupole.h:52
T isnan(T... args)

◆ PixelRegion() [2/3]

lsst::afw::geom::ellipses::PixelRegion::PixelRegion ( PixelRegion const &  )
default

◆ PixelRegion() [3/3]

lsst::afw::geom::ellipses::PixelRegion::PixelRegion ( PixelRegion &&  )
default

◆ ~PixelRegion()

lsst::afw::geom::ellipses::PixelRegion::~PixelRegion ( )
default

Member Function Documentation

◆ begin()

PixelRegion::Iterator lsst::afw::geom::ellipses::PixelRegion::begin ( ) const
inline

Definition at line 96 of file PixelRegion.h.

96  {
97  return Iterator(getSpanAt(_bbox.getBeginY()), this);
98 }
int getBeginY() const noexcept
Definition: Box.h:160
FastFinder::Iterator Iterator
Definition: FastFinder.cc:179
Span const getSpanAt(int y) const
Definition: PixelRegion.cc:44

◆ end()

PixelRegion::Iterator lsst::afw::geom::ellipses::PixelRegion::end ( ) const
inline

Definition at line 99 of file PixelRegion.h.

99 { return Iterator(getSpanAt(_bbox.getEndY()), this); }
int getEndY() const noexcept
Definition: Box.h:164
FastFinder::Iterator Iterator
Definition: FastFinder.cc:179
Span const getSpanAt(int y) const
Definition: PixelRegion.cc:44

◆ getBBox()

lsst::geom::Box2I const& lsst::afw::geom::ellipses::PixelRegion::getBBox ( ) const
inline

Definition at line 45 of file PixelRegion.h.

45 { return _bbox; }

◆ getSpanAt()

Span const lsst::afw::geom::ellipses::PixelRegion::getSpanAt ( int  y) const

Definition at line 44 of file PixelRegion.cc.

44  {
45  double yt = y - _center.getY();
46  double d = _invQxx - yt * yt / _detQ;
47  double x0 = _center.getX() + yt * _alpha;
48  double x1 = x0;
49  if (d > 0.0) {
50  d = std::sqrt(d) / _invQxx;
51  x0 -= d;
52  x1 += d;
53  } // Note that we return an empty span when d <= 0.0 or d is NaN.
54  return Span(y, std::ceil(x0), std::floor(x1));
55 }
T ceil(T... args)
int y
Definition: SpanSet.cc:49
T floor(T... args)
T sqrt(T... args)

◆ operator=() [1/2]

PixelRegion& lsst::afw::geom::ellipses::PixelRegion::operator= ( PixelRegion const &  )
default

◆ operator=() [2/2]

PixelRegion& lsst::afw::geom::ellipses::PixelRegion::operator= ( PixelRegion &&  )
default

The documentation for this class was generated from the following files: