20 *
this =
Frame(lowerLeft.
x, lowerLeft.
y, upperRight.
x, upperRight.
y);
24 xMin =
min(xmin, xmax);
25 xMax =
max(xmin, xmax);
26 yMin =
min(ymin, ymax);
27 yMax =
max(ymin, ymax);
34 return min(
min(point.
x - xMin, xMax - point.
x) ,
35 min(point.
y - yMin, yMax - point.
y) );
45 Frame rightCopy = right;
49 xMin =
max(xMin, rightCopy.
xMin);
54 if (xMin > xMax || yMin > yMax) *
this =
Frame();
65 Frame rightCopy = right;
69 xMin =
min(xMin, rightCopy.
xMin);
77 if (xMin > xMax)
swap(xMin, xMax);
78 if (yMin > yMax)
swap(yMin, yMax);
82 return ((xMin == right.
xMin) && (xMax == right.
xMax) && (yMin == right.
yMin) && (yMax == right.
yMax));
95 double hxsize =
fabs(factor * 0.5 * (xMax - xMin));
96 double xcenter = 0.5 * (xMax + xMin);
97 double hysize =
fabs(factor * 0.5 * (yMax - yMin));
98 double ycenter = 0.5 * (yMax + yMin);
99 return Frame(xcenter - hxsize, ycenter - hysize, xcenter + hxsize, ycenter + hysize);
105 return ((x <= xMax) && (y <= yMax) && (x >= xMin) && (y >= yMin));
109 stream <<
"xmin ymin " << xMin <<
' ' << yMin <<
" xmax ymax " << xMax <<
' ' << yMax <<
endl;
Frame operator+(const Frame &right) const
union of Frames
void cutMargin(const double marginSize)
shrinks the frame (if marginSize>0), enlarges it (if marginSize<0).
double xMin
coordinate of boundary.
Frame()
Default constructor.
Frame rescale(const double factor) const
rescale it. The center does not move.
rectangle with sides parallel to axes.
void dump(std::ostream &stream=std::cout) const
A base class for image defects.
double minDistToEdges(const Point &point) const
distance to closest boundary.
bool inFrame(double x, double y) const
inside?
void swap(Image< PixelT > &a, Image< PixelT > &b)
Frame & operator*=(const Frame &right)
intersection of Frame's
bool operator==(const Frame &right) const
necessary for comparisons (!= is defined from this one implicitely)
Frame operator*(const Frame &right) const
intersection of Frame's.
Frame & operator+=(const Frame &right)
union of Frames