LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Attributes | List of all members
lsst::meas::algorithms::shapelet::Bounds Class Reference

#include <Bounds.h>

Public Member Functions

 Bounds (double x1, double x2, double y1, double y2)
 
 Bounds (const Position &pos)
 
 Bounds ()
 
 ~Bounds ()
 
void setXMin (double x)
 
void setXMax (double x)
 
void setYMin (double y)
 
void setYMax (double y)
 
double getXMin () const
 
double getXMax () const
 
double getYMin () const
 
double getYMax () const
 
bool isDefined () const
 
Position getCenter () const
 
void operator+= (const Position &pos)
 
void operator+= (const Bounds &rec)
 
bool operator== (const Bounds &rhs) const
 
void snap (double d)
 
void addBorder (double d)
 
void addXBorder (double d)
 
void addYBorder (double d)
 
Bounds operator& (const Bounds &rhs) const
 
bool includes (const Position &pos) const
 
bool includes (double x, double y) const
 
bool includes (const Bounds &b2) const
 
bool intersects (const Bounds &b2) const
 
double getArea () const
 
std::vector< Boundsquarter () const
 
std::vector< Boundsdivide (int nx, int ny) const
 
void write (std::ostream &fout) const
 
void read (std::istream &fin)
 
Position get00 () const
 
Position get01 () const
 
Position get10 () const
 
Position get11 () const
 
bool isWide () const
 
bool isTall () const
 

Private Attributes

bool _isDefined
 
double _xMin
 
double _xMax
 
double _yMin
 
double _yMax
 

Detailed Description

Definition at line 84 of file Bounds.h.

Constructor & Destructor Documentation

lsst::meas::algorithms::shapelet::Bounds::Bounds ( double  x1,
double  x2,
double  y1,
double  y2 
)
inline
lsst::meas::algorithms::shapelet::Bounds::Bounds ( const Position pos)
inline

Definition at line 96 of file Bounds.h.

lsst::meas::algorithms::shapelet::Bounds::Bounds ( )
inline
lsst::meas::algorithms::shapelet::Bounds::~Bounds ( )
inline

Definition at line 102 of file Bounds.h.

102 {}

Member Function Documentation

void lsst::meas::algorithms::shapelet::Bounds::addBorder ( double  d)
void lsst::meas::algorithms::shapelet::Bounds::addXBorder ( double  d)

Definition at line 103 of file Bounds.cc.

void lsst::meas::algorithms::shapelet::Bounds::addYBorder ( double  d)

Definition at line 108 of file Bounds.cc.

std::vector< Bounds > lsst::meas::algorithms::shapelet::Bounds::divide ( int  nx,
int  ny 
) const

Definition at line 152 of file Bounds.cc.

153  {
154  if (!_isDefined) return std::vector<Bounds>(nx*ny);
155  std::vector<Bounds> temp;
156  temp.reserve(nx*ny);
157  std::vector<double> x(nx+1);
158  std::vector<double> y(ny+1);
159  x[0] = _xMin; x[nx] = _xMax;
160  y[0] = _yMin; y[ny] = _yMax;
161  double xstep = (_xMax-_xMin)/nx;
162  double ystep = (_yMax-_yMin)/ny;
163  for(int i=1;i<nx;++i) x[i] = x[0]+i*xstep;
164  for(int j=1;j<ny;++j) y[j] = y[0]+j*ystep;
165  for(int i=0;i<nx;++i) for(int j=0;j<ny;++j)
166  temp.push_back(Bounds(x[i],x[i+1],y[j],y[j+1]));
167  return temp;
168  }
int y
double x
Position lsst::meas::algorithms::shapelet::Bounds::get00 ( ) const
inline

Definition at line 158 of file Bounds.h.

Position lsst::meas::algorithms::shapelet::Bounds::get01 ( ) const
inline

Definition at line 160 of file Bounds.h.

Position lsst::meas::algorithms::shapelet::Bounds::get10 ( ) const
inline

Definition at line 162 of file Bounds.h.

Position lsst::meas::algorithms::shapelet::Bounds::get11 ( ) const
inline

Definition at line 164 of file Bounds.h.

double lsst::meas::algorithms::shapelet::Bounds::getArea ( ) const
Position lsst::meas::algorithms::shapelet::Bounds::getCenter ( ) const

Definition at line 78 of file Bounds.cc.

double lsst::meas::algorithms::shapelet::Bounds::getXMax ( ) const
inline

Definition at line 114 of file Bounds.h.

114 { return _xMax; }
double lsst::meas::algorithms::shapelet::Bounds::getXMin ( ) const
inline

Definition at line 112 of file Bounds.h.

112 { return _xMin; }
double lsst::meas::algorithms::shapelet::Bounds::getYMax ( ) const
inline

Definition at line 118 of file Bounds.h.

118 { return _yMax; }
double lsst::meas::algorithms::shapelet::Bounds::getYMin ( ) const
inline

Definition at line 116 of file Bounds.h.

116 { return _yMin; }
bool lsst::meas::algorithms::shapelet::Bounds::includes ( const Position pos) const

Definition at line 118 of file Bounds.cc.

119  {
120  return (_isDefined && pos.getX()<=_xMax && pos.getX()>=_xMin &&
121  pos.getY()<=_yMax && pos.getY()>=_yMin);
122  }
bool lsst::meas::algorithms::shapelet::Bounds::includes ( double  x,
double  y 
) const

Definition at line 124 of file Bounds.cc.

125  { return includes(Position(x,y)); }
int y
double x
bool includes(const Position &pos) const
Definition: Bounds.cc:118
bool lsst::meas::algorithms::shapelet::Bounds::includes ( const Bounds b2) const

Definition at line 127 of file Bounds.cc.

128  {
129  if (!b2.isDefined()) return true;
130  else return (
131  _isDefined &&
132  b2._xMin >= _xMin && b2._xMax <= _xMax &&
133  b2._yMin >= _yMin && b2._yMax <= _yMax);
134  }
bool lsst::meas::algorithms::shapelet::Bounds::intersects ( const Bounds b2) const

Definition at line 136 of file Bounds.cc.

137  {
138  return (
139  _isDefined && b2._isDefined &&
140  !(b2._xMin >= _xMax) &&
141  !(b2._xMax <= _xMin) &&
142  !(b2._yMin >= _yMax) &&
143  !(b2._yMax <= _yMin) );
144  }
bool lsst::meas::algorithms::shapelet::Bounds::isDefined ( ) const
inline

Definition at line 120 of file Bounds.h.

bool lsst::meas::algorithms::shapelet::Bounds::isTall ( ) const
inline
bool lsst::meas::algorithms::shapelet::Bounds::isWide ( ) const
inline
Bounds lsst::meas::algorithms::shapelet::Bounds::operator& ( const Bounds rhs) const

Definition at line 83 of file Bounds.cc.

84  {
85  Bounds temp(_xMin<rhs._xMin ? rhs._xMin : _xMin,
86  _xMax>rhs._xMax ? rhs._xMax : _xMax,
87  _yMin<rhs._yMin ? rhs._yMin : _yMin,
88  _yMax>rhs._yMax ? rhs._yMax : _yMax);
89  if (temp._xMin>temp._xMax || temp._yMin>temp._yMax) return Bounds();
90  else return temp;
91  }
void lsst::meas::algorithms::shapelet::Bounds::operator+= ( const Position pos)

Definition at line 40 of file Bounds.cc.

42  {
43  if (_isDefined) {
44  if (pos.getX() < _xMin) _xMin = pos.getX();
45  else if (pos.getX() > _xMax) _xMax = pos.getX();
46  if (pos.getY() < _yMin) _yMin = pos.getY();
47  else if (pos.getY() > _yMax) _yMax = pos.getY();
48  } else {
49  _xMin = _xMax = pos.getX();
50  _yMin = _yMax = pos.getY();
51  _isDefined = true;
52  }
53  }
void lsst::meas::algorithms::shapelet::Bounds::operator+= ( const Bounds rec)

Definition at line 55 of file Bounds.cc.

57  {
58  if (!rhs.isDefined()) return;
59  if (_isDefined) {
60  if (rhs.getXMin() < _xMin) _xMin = rhs.getXMin();
61  if (rhs.getXMax() > _xMax) _xMax = rhs.getXMax();
62  if (rhs.getYMin() < _yMin) _yMin = rhs.getYMin();
63  if (rhs.getYMax() > _yMax) _yMax = rhs.getYMax();
64  } else {
65  *this = rhs;
66  _isDefined = true;
67  }
68  }
bool lsst::meas::algorithms::shapelet::Bounds::operator== ( const Bounds rhs) const

Definition at line 70 of file Bounds.cc.

71  {
72  if (!_isDefined) return (!rhs._isDefined);
73  else return (_xMin == rhs._xMin && _xMax == rhs._xMax &&
74  _yMin == rhs._yMin && _yMax == rhs._yMax);
75  }
std::vector< Bounds > lsst::meas::algorithms::shapelet::Bounds::quarter ( ) const

Definition at line 149 of file Bounds.cc.

150  { return divide(2,2); }
std::vector< Bounds > divide(int nx, int ny) const
Definition: Bounds.cc:152
void lsst::meas::algorithms::shapelet::Bounds::read ( std::istream &  fin)
void lsst::meas::algorithms::shapelet::Bounds::setXMax ( double  x)
inline

Definition at line 106 of file Bounds.h.

void lsst::meas::algorithms::shapelet::Bounds::setXMin ( double  x)
inline

Definition at line 104 of file Bounds.h.

void lsst::meas::algorithms::shapelet::Bounds::setYMax ( double  y)
inline

Definition at line 110 of file Bounds.h.

void lsst::meas::algorithms::shapelet::Bounds::setYMin ( double  y)
inline

Definition at line 108 of file Bounds.h.

void lsst::meas::algorithms::shapelet::Bounds::snap ( double  d)

Definition at line 93 of file Bounds.cc.

94  {
95  if (_isDefined) {
96  _xMax = d*ceil(_xMax/d);
97  _xMin = d*floor(_xMin/d);
98  _yMax = d*ceil(_yMax/d);
99  _yMin = d*floor(_yMin/d);
100  }
101  }
Extent< int, N > ceil(Extent< double, N > const &input)
Extent< int, N > floor(Extent< double, N > const &input)
void lsst::meas::algorithms::shapelet::Bounds::write ( std::ostream &  fout) const

Definition at line 170 of file Bounds.cc.

Member Data Documentation

bool lsst::meas::algorithms::shapelet::Bounds::_isDefined
private

Definition at line 172 of file Bounds.h.

double lsst::meas::algorithms::shapelet::Bounds::_xMax
private

Definition at line 173 of file Bounds.h.

double lsst::meas::algorithms::shapelet::Bounds::_xMin
private

Definition at line 173 of file Bounds.h.

double lsst::meas::algorithms::shapelet::Bounds::_yMax
private

Definition at line 173 of file Bounds.h.

double lsst::meas::algorithms::shapelet::Bounds::_yMin
private

Definition at line 173 of file Bounds.h.


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