tesseract v5.3.3.20231005
tesseract::TBOX Class Reference

#include <rect.h>

Public Member Functions

 TBOX ()
 
 TBOX (const ICOORD pt1, const ICOORD pt2)
 
 TBOX (TDimension left, TDimension bottom, TDimension right, TDimension top)
 
 TBOX (const FCOORD pt)
 
bool null_box () const
 
bool operator== (const TBOX &other) const
 
TDimension top () const
 
void set_top (int y)
 
TDimension bottom () const
 
void set_bottom (int y)
 
TDimension left () const
 
void set_left (int x)
 
TDimension right () const
 
void set_right (int x)
 
int x_middle () const
 
int y_middle () const
 
const ICOORDbotleft () const
 
ICOORD botright () const
 
ICOORD topleft () const
 
const ICOORDtopright () const
 
TDimension height () const
 
TDimension width () const
 
int32_t area () const
 
void pad (int xpad, int ypad)
 
void move_bottom_edge (const TDimension y)
 
void move_left_edge (const TDimension x)
 
void move_right_edge (const TDimension x)
 
void move_top_edge (const TDimension y)
 
void move (const ICOORD vec)
 
void move (const FCOORD vec)
 
void scale (const float f)
 
void scale (const FCOORD vec)
 
void rotate (const FCOORD &vec)
 
void rotate_large (const FCOORD &vec)
 
bool contains (const FCOORD pt) const
 
bool contains (const TBOX &box) const
 
bool overlap (const TBOX &box) const
 
bool major_overlap (const TBOX &box) const
 
bool x_overlap (const TBOX &box) const
 
int x_gap (const TBOX &box) const
 
int y_gap (const TBOX &box) const
 
bool major_x_overlap (const TBOX &box) const
 
bool y_overlap (const TBOX &box) const
 
bool major_y_overlap (const TBOX &box) const
 
double overlap_fraction (const TBOX &box) const
 
double x_overlap_fraction (const TBOX &box) const
 
double y_overlap_fraction (const TBOX &box) const
 
bool x_almost_equal (const TBOX &box, int tolerance) const
 
bool almost_equal (const TBOX &box, int tolerance) const
 
TBOX intersection (const TBOX &box) const
 
TBOX bounding_union (const TBOX &box) const
 
void set_to_given_coords (int x_min, int y_min, int x_max, int y_max)
 
void print () const
 
void print_to_str (std::string &str) const
 
void plot (ScrollView *fd) const
 
void plot (ScrollView *fd, ScrollView::Color fill_colour, ScrollView::Color border_colour) const
 
bool Serialize (FILE *fp) const
 
bool Serialize (TFile *fp) const
 
bool DeSerialize (bool swap, FILE *fp)
 
bool DeSerialize (TFile *fp)
 

Friends

TBOXoperator+= (TBOX &, const TBOX &)
 
TBOXoperator&= (TBOX &, const TBOX &)
 

Detailed Description

Definition at line 37 of file rect.h.

Constructor & Destructor Documentation

◆ TBOX() [1/4]

tesseract::TBOX::TBOX ( )
inline

Definition at line 39 of file rect.h.

40 : // empty constructor making a null box
41 bot_left(INT16_MAX, INT16_MAX)
42 , top_right(-INT16_MAX, -INT16_MAX) {}

◆ TBOX() [2/4]

tesseract::TBOX::TBOX ( const ICOORD  pt1,
const ICOORD  pt2 
)

Definition at line 35 of file rect.cpp.

38 {
39 if (pt1.x() <= pt2.x()) {
40 if (pt1.y() <= pt2.y()) {
41 bot_left = pt1;
42 top_right = pt2;
43 } else {
44 bot_left = ICOORD(pt1.x(), pt2.y());
45 top_right = ICOORD(pt2.x(), pt1.y());
46 }
47 } else {
48 if (pt1.y() <= pt2.y()) {
49 bot_left = ICOORD(pt2.x(), pt1.y());
50 top_right = ICOORD(pt1.x(), pt2.y());
51 } else {
52 bot_left = pt2;
53 top_right = pt1;
54 }
55 }
56}

◆ TBOX() [3/4]

tesseract::TBOX::TBOX ( TDimension  left,
TDimension  bottom,
TDimension  right,
TDimension  top 
)
inline

Definition at line 53 of file rect.h.

55 : bot_left(left, bottom), top_right(right, top) {}
TDimension left() const
Definition: rect.h:82
TDimension top() const
Definition: rect.h:68
TDimension right() const
Definition: rect.h:89
TDimension bottom() const
Definition: rect.h:75

◆ TBOX() [4/4]

tesseract::TBOX::TBOX ( const FCOORD  pt)
inline

Definition at line 330 of file rect.h.

332 {
333 bot_left =
334 ICOORD(static_cast<TDimension>(std::floor(pt.x())), static_cast<TDimension>(std::floor(pt.y())));
335 top_right =
336 ICOORD(static_cast<TDimension>(std::ceil(pt.x())), static_cast<TDimension>(std::ceil(pt.y())));
337}
int16_t TDimension
Definition: tesstypes.h:32

Member Function Documentation

◆ almost_equal()

bool tesseract::TBOX::almost_equal ( const TBOX box,
int  tolerance 
) const

Definition at line 272 of file rect.cpp.

272 {
273 return (abs(left() - box.left()) <= tolerance && abs(right() - box.right()) <= tolerance &&
274 abs(top() - box.top()) <= tolerance && abs(bottom() - box.bottom()) <= tolerance);
275}

◆ area()

int32_t tesseract::TBOX::area ( ) const
inline

Definition at line 134 of file rect.h.

134 { // what is the area?
135 if (!null_box()) {
136 return width() * height();
137 } else {
138 return 0;
139 }
140 }
TDimension height() const
Definition: rect.h:118
TDimension width() const
Definition: rect.h:126
bool null_box() const
Definition: rect.h:60

◆ botleft()

const ICOORD & tesseract::TBOX::botleft ( ) const
inline

Definition at line 102 of file rect.h.

102 { // access function
103 return bot_left;
104 }

◆ botright()

ICOORD tesseract::TBOX::botright ( ) const
inline

Definition at line 106 of file rect.h.

106 { // ~ access function
107 return ICOORD(top_right.x(), bot_left.y());
108 }
TDimension y() const
access_function
Definition: points.h:62
TDimension x() const
access function
Definition: points.h:58

◆ bottom()

TDimension tesseract::TBOX::bottom ( ) const
inline

Definition at line 75 of file rect.h.

75 { // coord of bottom
76 return bot_left.y();
77 }

◆ bounding_union()

TBOX tesseract::TBOX::bounding_union ( const TBOX box) const

Definition at line 128 of file rect.cpp.

129 {
130 ICOORD bl; // bottom left
131 ICOORD tr; // top right
132
133 if (box.bot_left.x() < bot_left.x()) {
134 bl.set_x(box.bot_left.x());
135 } else {
136 bl.set_x(bot_left.x());
137 }
138
139 if (box.top_right.x() > top_right.x()) {
140 tr.set_x(box.top_right.x());
141 } else {
142 tr.set_x(top_right.x());
143 }
144
145 if (box.bot_left.y() < bot_left.y()) {
146 bl.set_y(box.bot_left.y());
147 } else {
148 bl.set_y(bot_left.y());
149 }
150
151 if (box.top_right.y() > top_right.y()) {
152 tr.set_y(box.top_right.y());
153 } else {
154 tr.set_y(top_right.y());
155 }
156 return TBOX(bl, tr);
157}

◆ contains() [1/2]

bool tesseract::TBOX::contains ( const FCOORD  pt) const
inline

Definition at line 344 of file rect.h.

344 {
345 return ((pt.x() >= bot_left.x()) && (pt.x() <= top_right.x()) && (pt.y() >= bot_left.y()) &&
346 (pt.y() <= top_right.y()));
347}

◆ contains() [2/2]

bool tesseract::TBOX::contains ( const TBOX box) const
inline

Definition at line 354 of file rect.h.

354 {
355 return (contains(box.bot_left) && contains(box.top_right));
356}
bool contains(const FCOORD pt) const
Definition: rect.h:344

◆ DeSerialize() [1/2]

bool tesseract::TBOX::DeSerialize ( bool  swap,
FILE *  fp 
)

Definition at line 198 of file rect.cpp.

198 {
199 if (!bot_left.DeSerialize(swap, fp)) {
200 return false;
201 }
202 if (!top_right.DeSerialize(swap, fp)) {
203 return false;
204 }
205 return true;
206}
bool DeSerialize(TFile *f)
Definition: points.cpp:43

◆ DeSerialize() [2/2]

bool tesseract::TBOX::DeSerialize ( TFile fp)

Definition at line 58 of file rect.cpp.

58 {
59 return bot_left.DeSerialize(f) && top_right.DeSerialize(f);
60}

◆ height()

TDimension tesseract::TBOX::height ( ) const
inline

Definition at line 118 of file rect.h.

118 { // how high is it?
119 if (!null_box()) {
120 return top_right.y() - bot_left.y();
121 } else {
122 return 0;
123 }
124 }

◆ intersection()

TBOX tesseract::TBOX::intersection ( const TBOX box) const

Definition at line 84 of file rect.cpp.

85 {
90 if (overlap(box)) {
91 if (box.bot_left.x() > bot_left.x()) {
92 left = box.bot_left.x();
93 } else {
94 left = bot_left.x();
95 }
96
97 if (box.top_right.x() < top_right.x()) {
98 right = box.top_right.x();
99 } else {
100 right = top_right.x();
101 }
102
103 if (box.bot_left.y() > bot_left.y()) {
104 bottom = box.bot_left.y();
105 } else {
106 bottom = bot_left.y();
107 }
108
109 if (box.top_right.y() < top_right.y()) {
110 top = box.top_right.y();
111 } else {
112 top = top_right.y();
113 }
114 } else {
115 left = INT16_MAX;
116 bottom = INT16_MAX;
117 top = -INT16_MAX;
118 right = -INT16_MAX;
119 }
120 return TBOX(left, bottom, right, top);
121}
bool overlap(const TBOX &box) const
Definition: rect.h:363

◆ left()

TDimension tesseract::TBOX::left ( ) const
inline

Definition at line 82 of file rect.h.

82 { // coord of left
83 return bot_left.x();
84 }

◆ major_overlap()

bool tesseract::TBOX::major_overlap ( const TBOX box) const
inline

Definition at line 374 of file rect.h.

375 {
376 int overlap = std::min(box.top_right.x(), top_right.x());
377 overlap -= std::max(box.bot_left.x(), bot_left.x());
378 overlap += overlap;
379 if (overlap < std::min(box.width(), width())) {
380 return false;
381 }
382 overlap = std::min(box.top_right.y(), top_right.y());
383 overlap -= std::max(box.bot_left.y(), bot_left.y());
384 overlap += overlap;
385 if (overlap < std::min(box.height(), height())) {
386 return false;
387 }
388 return true;
389}

◆ major_x_overlap()

bool tesseract::TBOX::major_x_overlap ( const TBOX box) const
inline

Definition at line 419 of file rect.h.

419 {
420 TDimension overlap = box.width();
421 if (this->left() > box.left()) {
422 overlap -= this->left() - box.left();
423 }
424 if (this->right() < box.right()) {
425 overlap -= box.right() - this->right();
426 }
427 return (overlap >= box.width() / 2 || overlap >= this->width() / 2);
428}

◆ major_y_overlap()

bool tesseract::TBOX::major_y_overlap ( const TBOX box) const
inline

Definition at line 445 of file rect.h.

445 {
446 TDimension overlap = box.height();
447 if (this->bottom() > box.bottom()) {
448 overlap -= this->bottom() - box.bottom();
449 }
450 if (this->top() < box.top()) {
451 overlap -= box.top() - this->top();
452 }
453 return (overlap >= box.height() / 2 || overlap >= this->height() / 2);
454}

◆ move() [1/2]

void tesseract::TBOX::move ( const FCOORD  vec)
inline

Definition at line 176 of file rect.h.

177 { // by float vector
178 bot_left.set_x(static_cast<TDimension>(std::floor(bot_left.x() + vec.x())));
179 // round left
180 bot_left.set_y(static_cast<TDimension>(std::floor(bot_left.y() + vec.y())));
181 // round down
182 top_right.set_x(static_cast<TDimension>(std::ceil(top_right.x() + vec.x())));
183 // round right
184 top_right.set_y(static_cast<TDimension>(std::ceil(top_right.y() + vec.y())));
185 // round up
186 }
void set_x(TDimension xin)
rewrite function
Definition: points.h:67
void set_y(TDimension yin)
rewrite function
Definition: points.h:71

◆ move() [2/2]

void tesseract::TBOX::move ( const ICOORD  vec)
inline

Definition at line 170 of file rect.h.

171 { // by vector
172 bot_left += vec;
173 top_right += vec;
174 }

◆ move_bottom_edge()

void tesseract::TBOX::move_bottom_edge ( const TDimension  y)
inline

Definition at line 150 of file rect.h.

151 { // by +/- y
152 bot_left += ICOORD(0, y);
153 }
const double y

◆ move_left_edge()

void tesseract::TBOX::move_left_edge ( const TDimension  x)
inline

Definition at line 155 of file rect.h.

156 { // by +/- x
157 bot_left += ICOORD(x, 0);
158 }

◆ move_right_edge()

void tesseract::TBOX::move_right_edge ( const TDimension  x)
inline

Definition at line 160 of file rect.h.

161 { // by +/- x
162 top_right += ICOORD(x, 0);
163 }

◆ move_top_edge()

void tesseract::TBOX::move_top_edge ( const TDimension  y)
inline

Definition at line 165 of file rect.h.

166 { // by +/- y
167 top_right += ICOORD(0, y);
168 }

◆ null_box()

bool tesseract::TBOX::null_box ( ) const
inline

Definition at line 60 of file rect.h.

60 { // Is box null
61 return ((left() >= right()) || (top() <= bottom()));
62 }

◆ operator==()

bool tesseract::TBOX::operator== ( const TBOX other) const
inline

Definition at line 64 of file rect.h.

64 {
65 return bot_left == other.bot_left && top_right == other.top_right;
66 }

◆ overlap()

bool tesseract::TBOX::overlap ( const TBOX box) const
inline

Definition at line 363 of file rect.h.

364 {
365 return ((box.bot_left.x() <= top_right.x()) && (box.top_right.x() >= bot_left.x()) &&
366 (box.bot_left.y() <= top_right.y()) && (box.top_right.y() >= bot_left.y()));
367}

◆ overlap_fraction()

double tesseract::TBOX::overlap_fraction ( const TBOX box) const
inline

Definition at line 396 of file rect.h.

396 {
397 double fraction = 0.0;
398 if (this->area()) {
399 fraction = this->intersection(box).area() * 1.0 / this->area();
400 }
401 return fraction;
402}
TBOX intersection(const TBOX &box) const
Definition: rect.cpp:84
int32_t area() const
Definition: rect.h:134

◆ pad()

void tesseract::TBOX::pad ( int  xpad,
int  ypad 
)
inline

Definition at line 144 of file rect.h.

144 {
145 ICOORD pad(xpad, ypad);
146 bot_left -= pad;
147 top_right += pad;
148 }
void pad(int xpad, int ypad)
Definition: rect.h:144

◆ plot() [1/2]

void tesseract::TBOX::plot ( ScrollView fd) const
inline

Definition at line 296 of file rect.h.

297 { // where to paint
298 fd->Rectangle(bot_left.x(), bot_left.y(), top_right.x(), top_right.y());
299 }

◆ plot() [2/2]

void tesseract::TBOX::plot ( ScrollView fd,
ScrollView::Color  fill_colour,
ScrollView::Color  border_colour 
) const

Definition at line 165 of file rect.cpp.

169 {
170 fd->Brush(fill_colour);
171 fd->Pen(border_colour);
172 plot(fd);
173}
void plot(ScrollView *fd) const
Definition: rect.h:296

◆ print()

void tesseract::TBOX::print ( ) const
inline

Definition at line 289 of file rect.h.

289 { // print
290 tprintf("Bounding box=(%d,%d)->(%d,%d)\n", left(), bottom(), right(), top());
291 }
void tprintf(const char *format,...)
Definition: tprintf.cpp:41

◆ print_to_str()

void tesseract::TBOX::print_to_str ( std::string &  str) const

Definition at line 177 of file rect.cpp.

177 {
178 // "(%d,%d)->(%d,%d)", left(), bottom(), right(), top()
179 str += "(" + std::to_string(left());
180 str += "," + std::to_string(bottom());
181 str += ")->(" + std::to_string(right());
182 str += "," + std::to_string(top());
183 str += ')';
184}

◆ right()

TDimension tesseract::TBOX::right ( ) const
inline

Definition at line 89 of file rect.h.

89 { // coord of right
90 return top_right.x();
91 }

◆ rotate()

void tesseract::TBOX::rotate ( const FCOORD vec)
inline

Definition at line 210 of file rect.h.

210 { // by vector
211 bot_left.rotate(vec);
212 top_right.rotate(vec);
213 *this = TBOX(bot_left, top_right);
214 }
void rotate(const FCOORD &vec)
Definition: points.h:511

◆ rotate_large()

void tesseract::TBOX::rotate_large ( const FCOORD vec)

Definition at line 69 of file rect.cpp.

69 {
70 ICOORD top_left(bot_left.x(), top_right.y());
71 ICOORD bottom_right(top_right.x(), bot_left.y());
72 top_left.rotate(vec);
73 bottom_right.rotate(vec);
74 rotate(vec);
75 TBOX box2(top_left, bottom_right);
76 *this += box2;
77}
void rotate(const FCOORD &vec)
Definition: rect.h:210

◆ scale() [1/2]

void tesseract::TBOX::scale ( const FCOORD  vec)
inline

Definition at line 199 of file rect.h.

200 { // by float vector
201 bot_left.set_x(static_cast<TDimension>(std::floor(bot_left.x() * vec.x())));
202 bot_left.set_y(static_cast<TDimension>(std::floor(bot_left.y() * vec.y())));
203 top_right.set_x(static_cast<TDimension>(std::ceil(top_right.x() * vec.x())));
204 top_right.set_y(static_cast<TDimension>(std::ceil(top_right.y() * vec.y())));
205 }

◆ scale() [2/2]

void tesseract::TBOX::scale ( const float  f)
inline

Definition at line 188 of file rect.h.

189 { // by multiplier
190 // round left
191 bot_left.set_x(static_cast<TDimension>(std::floor(bot_left.x() * f)));
192 // round down
193 bot_left.set_y(static_cast<TDimension>(std::floor(bot_left.y() * f)));
194 // round right
195 top_right.set_x(static_cast<TDimension>(std::ceil(top_right.x() * f)));
196 // round up
197 top_right.set_y(static_cast<TDimension>(std::ceil(top_right.y() * f)));
198 }

◆ Serialize() [1/2]

bool tesseract::TBOX::Serialize ( FILE *  fp) const

Definition at line 187 of file rect.cpp.

187 {
188 if (!bot_left.Serialize(fp)) {
189 return false;
190 }
191 if (!top_right.Serialize(fp)) {
192 return false;
193 }
194 return true;
195}
bool Serialize(TFile *f) const
Definition: points.cpp:47

◆ Serialize() [2/2]

bool tesseract::TBOX::Serialize ( TFile fp) const

Definition at line 62 of file rect.cpp.

62 {
63 return bot_left.Serialize(f) && top_right.Serialize(f);
64}

◆ set_bottom()

void tesseract::TBOX::set_bottom ( int  y)
inline

Definition at line 78 of file rect.h.

78 {
79 bot_left.set_y(y);
80 }

◆ set_left()

void tesseract::TBOX::set_left ( int  x)
inline

Definition at line 85 of file rect.h.

85 {
86 bot_left.set_x(x);
87 }

◆ set_right()

void tesseract::TBOX::set_right ( int  x)
inline

Definition at line 92 of file rect.h.

92 {
93 top_right.set_x(x);
94 }

◆ set_to_given_coords()

void tesseract::TBOX::set_to_given_coords ( int  x_min,
int  y_min,
int  x_max,
int  y_max 
)
inline

Definition at line 282 of file rect.h.

282 {
283 bot_left.set_x(x_min);
284 bot_left.set_y(y_min);
285 top_right.set_x(x_max);
286 top_right.set_y(y_max);
287 }

◆ set_top()

void tesseract::TBOX::set_top ( int  y)
inline

Definition at line 71 of file rect.h.

71 {
72 top_right.set_y(y);
73 }

◆ top()

TDimension tesseract::TBOX::top ( ) const
inline

Definition at line 68 of file rect.h.

68 { // coord of top
69 return top_right.y();
70 }

◆ topleft()

ICOORD tesseract::TBOX::topleft ( ) const
inline

Definition at line 110 of file rect.h.

110 { // ~ access function
111 return ICOORD(bot_left.x(), top_right.y());
112 }

◆ topright()

const ICOORD & tesseract::TBOX::topright ( ) const
inline

Definition at line 114 of file rect.h.

114 { // access function
115 return top_right;
116 }

◆ width()

TDimension tesseract::TBOX::width ( ) const
inline

Definition at line 126 of file rect.h.

126 { // how high is it?
127 if (!null_box()) {
128 return top_right.x() - bot_left.x();
129 } else {
130 return 0;
131 }
132 }

◆ x_almost_equal()

bool tesseract::TBOX::x_almost_equal ( const TBOX box,
int  tolerance 
) const

Definition at line 268 of file rect.cpp.

268 {
269 return (abs(left() - box.left()) <= tolerance && abs(right() - box.right()) <= tolerance);
270}

◆ x_gap()

int tesseract::TBOX::x_gap ( const TBOX box) const
inline

Definition at line 238 of file rect.h.

238 {
239 return std::max(bot_left.x(), box.bot_left.x()) - std::min(top_right.x(), box.top_right.x());
240 }

◆ x_middle()

int tesseract::TBOX::x_middle ( ) const
inline

Definition at line 95 of file rect.h.

95 {
96 return (bot_left.x() + top_right.x()) / 2;
97 }

◆ x_overlap()

bool tesseract::TBOX::x_overlap ( const TBOX box) const
inline

Definition at line 409 of file rect.h.

409 {
410 return ((box.bot_left.x() <= top_right.x()) && (box.top_right.x() >= bot_left.x()));
411}

◆ x_overlap_fraction()

double tesseract::TBOX::x_overlap_fraction ( const TBOX box) const
inline

Definition at line 463 of file rect.h.

463 {
464 int low = std::max(left(), other.left());
465 int high = std::min(right(), other.right());
466 int width = right() - left();
467 if (width == 0) {
468 int x = left();
469 if (other.left() <= x && x <= other.right()) {
470 return 1.0;
471 } else {
472 return 0.0;
473 }
474 } else {
475 return std::max(0.0, static_cast<double>(high - low) / width);
476 }
477}

◆ y_gap()

int tesseract::TBOX::y_gap ( const TBOX box) const
inline

Definition at line 245 of file rect.h.

245 {
246 return std::max(bot_left.y(), box.bot_left.y()) - std::min(top_right.y(), box.top_right.y());
247 }

◆ y_middle()

int tesseract::TBOX::y_middle ( ) const
inline

Definition at line 98 of file rect.h.

98 {
99 return (bot_left.y() + top_right.y()) / 2;
100 }

◆ y_overlap()

bool tesseract::TBOX::y_overlap ( const TBOX box) const
inline

Definition at line 435 of file rect.h.

435 {
436 return ((box.bot_left.y() <= top_right.y()) && (box.top_right.y() >= bot_left.y()));
437}

◆ y_overlap_fraction()

double tesseract::TBOX::y_overlap_fraction ( const TBOX box) const
inline

Definition at line 486 of file rect.h.

486 {
487 int low = std::max(bottom(), other.bottom());
488 int high = std::min(top(), other.top());
489 int height = top() - bottom();
490 if (height == 0) {
491 int y = bottom();
492 if (other.bottom() <= y && y <= other.top()) {
493 return 1.0;
494 } else {
495 return 0.0;
496 }
497 } else {
498 return std::max(0.0, static_cast<double>(high - low) / height);
499 }
500}

Friends And Related Function Documentation

◆ operator&=

TBOX & operator&= ( TBOX op1,
const TBOX op2 
)
friend

Definition at line 242 of file rect.cpp.

242 {
243 if (op1.overlap(op2)) {
244 if (op2.bot_left.x() > op1.bot_left.x()) {
245 op1.bot_left.set_x(op2.bot_left.x());
246 }
247
248 if (op2.top_right.x() < op1.top_right.x()) {
249 op1.top_right.set_x(op2.top_right.x());
250 }
251
252 if (op2.bot_left.y() > op1.bot_left.y()) {
253 op1.bot_left.set_y(op2.bot_left.y());
254 }
255
256 if (op2.top_right.y() < op1.top_right.y()) {
257 op1.top_right.set_y(op2.top_right.y());
258 }
259 } else {
260 op1.bot_left.set_x(INT16_MAX);
261 op1.bot_left.set_y(INT16_MAX);
262 op1.top_right.set_x(-INT16_MAX);
263 op1.top_right.set_y(-INT16_MAX);
264 }
265 return op1;
266}

◆ operator+=

TBOX & operator+= ( TBOX op1,
const TBOX op2 
)
friend

Definition at line 214 of file rect.cpp.

216 {
217 if (op2.bot_left.x() < op1.bot_left.x()) {
218 op1.bot_left.set_x(op2.bot_left.x());
219 }
220
221 if (op2.top_right.x() > op1.top_right.x()) {
222 op1.top_right.set_x(op2.top_right.x());
223 }
224
225 if (op2.bot_left.y() < op1.bot_left.y()) {
226 op1.bot_left.set_y(op2.bot_left.y());
227 }
228
229 if (op2.top_right.y() > op1.top_right.y()) {
230 op1.top_right.set_y(op2.top_right.y());
231 }
232
233 return op1;
234}

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