Class Frame

Class Documentation

class Frame

rectangle with sides parallel to axes.

when Frame’s are used to define subparts of images, xMin and xMax refer to the first and last pixels in the subimage

Public Functions

Frame()

Default constructor.

Frame(double xMin, double yMin, double xMax, double yMax)

this one is dangerous: you may swap the 2 middle arguments. Prefer next one

Frame(const Point &lowerLeft, const Point &upperRight)

typical use: Frame(Point(xmin,ymin),Point(xmax,ymax))

double getWidth() const

size along x axis

double getHeight() const

size along y axis

Point getCenter() const

Center of the frame.

Frame operator*(const Frame &right) const

intersection of Frame’s.

Frame &operator*=(const Frame &right)

intersection of Frame’s

Frame operator+(const Frame &right) const

union of Frames

Frame &operator+=(const Frame &right)

union of Frames

void cutMargin(const double marginSize)

shrinks the frame (if marginSize>0), enlarges it (if marginSize<0).

void cutMargin(const double marginX, const double marginY)

shrinks the frame (if marginSize>0), enlarges it (if marginSize<0).

bool operator==(const Frame &right) const

necessary for comparisons (!= is defined from this one implicitely)

bool operator!=(const Frame &right) const

comparison

Frame rescale(const double factor) const

rescale it. The center does not move.

double getArea() const
bool inFrame(double x, double y) const

inside?

bool inFrame(const Point &point) const

same as above

double minDistToEdges(const Point &point) const

distance to closest boundary.

void dump(std::ostream &stream = std::cout) const

Public Members

double xMin

coordinate of boundary.

double xMax
double yMin
double yMax

Friends

std::ostream &operator<<(std::ostream &stream, const Frame &right)

allows

std::cout << frame;
.