26#include "boost/optional.hpp"
66 _center(ellipse.getCenter()),
67 _p(0.0), _t(0.0), _r(0.0)
76 _r = q(0, 0) - q(0, 1)*_p;
81 boost::optional<std::pair<double, double>>
xAt(
double y)
const {
82 double yc = y - _center.getY();
83 double xc = _p*yc + _center.getX();
84 double s = _r - _t*yc*yc;
101 : _bbox(ellipse.computeBBox(),
lsst::
geom::Box2I::EXPAND)
118 int const yEnd = envelope.
getEndY();
119 for (
int y = envelope.
getBeginY(); y != yEnd; ++y) {
120 auto x = intersection.
xAt(y);
124 if (xMax < xMin)
continue;
125 _spans.emplace_back(y, xMin, xMax);
133 if (_bbox.isEmpty()) {
136 "PixelRegion is empty."
139 if (y < _bbox.getMinY() || y > _bbox.getMaxY()) {
142 (boost::format(
"No span at y=%s in pixel region with rows between y=%s and y=%s")
143 % y % _bbox.getMinY() % _bbox.getMaxY()).str()
146 return _spans[y - _bbox.getBeginY()];
#define LSST_EXCEPT(type,...)
A range of pixels within one row of an Image.
EllipseHorizontalLineIntersection(Ellipse const &ellipse)
boost::optional< std::pair< double, double > > xAt(double y) const
An ellipse defined by an arbitrary BaseCore and a center point.
lsst::geom::Box2D computeBBox() const
Return the bounding box of the ellipse.
BaseCore const & getCore() const
Return the ellipse core.
PixelRegion(Ellipse const &ellipse)
Construct a PixelRegion from an Ellipse.
Span const getSpanAt(int y) const
Return the span at the given y coordinate value.
An ellipse core with quadrupole moments as parameters.
void normalize() override
Put the parameters into a "standard form", and throw InvalidParameterError if they cannot be normaliz...
Matrix const & getMatrix() const
Return a 2x2 symmetric matrix of the parameters.
bool isEmpty() const noexcept
int getEndY() const noexcept
int getBeginY() const noexcept
Point< double, 2 > Point2D