28 #include <boost/format.hpp>
40 RegistryMap& getRegistry() {
41 static RegistryMap instance;
46 RegistryMap::iterator i = getRegistry().find(
name);
47 if (i == getRegistry().
end()) {
49 (
boost::format(
"Ellipse core with name '%s' not found in registry.") %
name).str());
51 return i->second->clone();
64 result->setParameterVector(parameters);
93 getRegistry()[example->getName()] = example;
125 double ixx, iyy, ixy;
157 if (&
other !=
this) {
161 other._assignToAxes(
a,
b, theta);
172 return Jacobian::Identity();
178 double ixx, iyy, ixy;
186 double xx_p_yy = ixx + iyy;
187 double xx_m_yy = ixx - iyy;
188 double t =
std::sqrt(xx_m_yy * xx_m_yy + 4 * ixy * ixy);
195 double&
b,
double& theta) {
196 double xx_p_yy = ixx + iyy;
197 double xx_m_yy = ixx - iyy;
198 double t2 = xx_m_yy * xx_m_yy + 4.0 * ixy * ixy;
199 Eigen::Vector3d dt2(2.0 * xx_m_yy, -2.0 * xx_m_yy, 8.0 * ixy);
205 m(0, 0) = 0.25 * (1.0 + 0.5 * dt2[0] / t) /
a;
206 m(0, 1) = 0.25 * (1.0 + 0.5 * dt2[1] / t) /
a;
207 m(0, 2) = 0.25 * (0.5 * dt2[2] / t) /
a;
208 m(1, 0) = 0.25 * (1.0 - 0.5 * dt2[0] / t) /
b;
209 m(1, 1) = 0.25 * (1.0 - 0.5 * dt2[1] / t) /
b;
210 m(1, 2) = 0.25 * (-0.5 * dt2[2] / t) /
b;
212 m.row(2).setConstant(1.0 / (t * t));
225 ixy = (
a -
b) * c * s;
233 double& iyy,
double& ixy) {
235 m.col(0).setConstant(2 *
a);
236 m.col(1).setConstant(2 *
b);
239 m.col(2).setConstant(
a -
b);
243 ixy = (
a -
b) * c * s;
250 m(0, 2) *= -2.0 * cs;
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
afw::table::PointKey< int > dimensions
ItemVariant const * other
A temporary-only expression object for ellipse core convolution.
A base class for parametrizations of the "core" of an ellipse - the ellipticity and size.
virtual void writeParameters(double *iter) const =0
Return the size of the bounding box for the ellipse core.
Eigen::Vector3d ParameterVector
Parameter vector type.
static Jacobian _dAssignAxesToQuadrupole(double a, double b, double theta, double &ixx, double &iyy, double &ixy)
Return the size of the bounding box for the ellipse core.
static void registerSubclass(std::shared_ptr< BaseCore > const &example)
Return the size of the bounding box for the ellipse core.
void scale(double factor)
Scale the size of the ellipse core by the given factor.
virtual void readParameters(double const *iter)=0
Return the size of the bounding box for the ellipse core.
double getArea() const
Return the area of the ellipse core.
virtual void _assignToQuadrupole(double &ixx, double &iyy, double &ixy) const =0
Return the size of the bounding box for the ellipse core.
void setParameterVector(ParameterVector const &vector)
Set the core parameters from a vector.
virtual std::string getName() const =0
Return a string that identifies this parametrization.
virtual void _assignToAxes(double &a, double &b, double &theta) const =0
Return the size of the bounding box for the ellipse core.
double getDeterminantRadius() const
Return the radius defined as the 4th root of the determinant of the quadrupole matrix.
bool operator==(BaseCore const &other) const
Compare two ellipse cores for equality.
virtual Jacobian _dAssignFromQuadrupole(double ixx, double iyy, double ixy)=0
Return the size of the bounding box for the ellipse core.
lsst::geom::Extent2D computeDimensions() const
Return the size of the bounding box for the ellipse core.
static void _assignAxesToQuadrupole(double a, double b, double theta, double &ixx, double &iyy, double &ixy)
Return the size of the bounding box for the ellipse core.
static Jacobian _dAssignQuadrupoleToAxes(double ixx, double iyy, double ixy, double &a, double &b, double &theta)
Return the size of the bounding box for the ellipse core.
ParameterVector const getParameterVector() const
Return the core parameters as a vector.
Jacobian dAssign(BaseCore const &other)
Assign other to this and return the derivative of the conversion, d(this)/d(other).
virtual void _assignFromAxes(double a, double b, double theta)=0
Return the size of the bounding box for the ellipse core.
static std::shared_ptr< BaseCore > make(std::string const &name)
void grow(double buffer)
Increase the major and minor radii of the ellipse core by the given buffer.
Eigen::Matrix3d Jacobian
Parameter Jacobian matrix type.
static void _assignQuadrupoleToAxes(double ixx, double iyy, double ixy, double &a, double &b, double &theta)
Return the size of the bounding box for the ellipse core.
double getTraceRadius() const
Return the radius defined as the square root of one half the trace of the quadrupole matrix.
BaseCore & operator=(BaseCore const &other)
Set the parameters of this ellipse core from another.
An ellipse core with quadrupole moments as parameters.
Reports invalid arguments.
constexpr double PI
The ratio of a circle's circumference to diameter.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
A base class for image defects.