Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rect.cpp File Reference
#include "mfcpch.h"
#include "rect.h"

Go to the source code of this file.

Functions

DLLSYM TBOXoperator+= (TBOX &op1, const TBOX &op2)
 
TBOXoperator&= (TBOX &op1, const TBOX &op2)
 

Function Documentation

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

Definition at line 221 of file rect.cpp.

221  {
222  if (op1.overlap (op2)) {
223  if (op2.bot_left.x () > op1.bot_left.x ())
224  op1.bot_left.set_x (op2.bot_left.x ());
225 
226  if (op2.top_right.x () < op1.top_right.x ())
227  op1.top_right.set_x (op2.top_right.x ());
228 
229  if (op2.bot_left.y () > op1.bot_left.y ())
230  op1.bot_left.set_y (op2.bot_left.y ());
231 
232  if (op2.top_right.y () < op1.top_right.y ())
233  op1.top_right.set_y (op2.top_right.y ());
234  }
235  else {
236  op1.bot_left.set_x (MAX_INT16);
237  op1.bot_left.set_y (MAX_INT16);
238  op1.top_right.set_x (-MAX_INT16);
239  op1.top_right.set_y (-MAX_INT16);
240  }
241  return op1;
242 }
inT16 x() const
access function
Definition: points.h:52
bool overlap(const TBOX &box) const
Definition: rect.h:345
inT16 y() const
access_function
Definition: points.h:56
void set_y(inT16 yin)
rewrite function
Definition: points.h:65
void set_x(inT16 xin)
rewrite function
Definition: points.h:61
#define MAX_INT16
Definition: host.h:119
DLLSYM TBOX& operator+= ( TBOX op1,
const TBOX op2 
)

Definition at line 196 of file rect.cpp.

198  {
199  if (op2.bot_left.x () < op1.bot_left.x ())
200  op1.bot_left.set_x (op2.bot_left.x ());
201 
202  if (op2.top_right.x () > op1.top_right.x ())
203  op1.top_right.set_x (op2.top_right.x ());
204 
205  if (op2.bot_left.y () < op1.bot_left.y ())
206  op1.bot_left.set_y (op2.bot_left.y ());
207 
208  if (op2.top_right.y () > op1.top_right.y ())
209  op1.top_right.set_y (op2.top_right.y ());
210 
211  return op1;
212 }
inT16 x() const
access function
Definition: points.h:52
inT16 y() const
access_function
Definition: points.h:56
void set_y(inT16 yin)
rewrite function
Definition: points.h:65
void set_x(inT16 xin)
rewrite function
Definition: points.h:61