32 #ifndef DRAIN_FRAME_H_
33 #define DRAIN_FRAME_H_
38 #include <drain/Log.h>
39 #include <drain/UniTuple.h>
40 #include <drain/Type.h>
41 #include <drain/util/Point.h>
61 Frame2D(T width=0, T height=0) : width(this->next()), height(this->next()){
62 this->set(width, height?height:width);
65 Frame2D(
const Frame2D<T> & geometry) : width(this->next()), height(this->next()) {
66 this->set(geometry.width, geometry.height);
71 this->set(geometry.width, geometry.height);
88 this->set(geometry.width, geometry.height);
96 Frame2D & operator=(
const T2 & frame){
116 void setArea(T w, T h){
135 T getHeight()
const {
146 return (width==0) || (height==0);
205 expand(box.x + box.width, box.y + box.height);
208 void expand(
const T & x,
const T & y){
212 m = std::max(this->x + this->width, x);
213 this->x = std::min(this->x, x);
214 this->width = m - this->x;
216 m = std::max(this->y + this->height, y);
217 this->y = std::min(this->y, y);
218 this->height = m - this->y;
245 DRAIN_TYPENAME_T(Box, T);
249 std::ostream &operator<<(std::ostream &ostr,
const drain::Box<T> &box)
Something that has width and height.
Definition: Frame.h:53
Tuple of N elements of type T.
Definition: UniTuple.h:65
Definition: DataSelector.cpp:1277
Something that has coordinates (x,y) and dimensions (width, height).
Definition: Frame.h:160
void expand(const Box &box)
Update this box such that it contains the given bbox .
Definition: Frame.h:194