Tesseract  3.02
tesseract-ocr/ccstruct/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.

                                             {
  if (op1.overlap (op2)) {
    if (op2.bot_left.x () > op1.bot_left.x ())
      op1.bot_left.set_x (op2.bot_left.x ());

    if (op2.top_right.x () < op1.top_right.x ())
      op1.top_right.set_x (op2.top_right.x ());

    if (op2.bot_left.y () > op1.bot_left.y ())
      op1.bot_left.set_y (op2.bot_left.y ());

    if (op2.top_right.y () < op1.top_right.y ())
      op1.top_right.set_y (op2.top_right.y ());
  }
  else {
    op1.bot_left.set_x (MAX_INT16);
    op1.bot_left.set_y (MAX_INT16);
    op1.top_right.set_x (-MAX_INT16);
    op1.top_right.set_y (-MAX_INT16);
  }
  return op1;
}
DLLSYM TBOX& operator+= ( TBOX op1,
const TBOX op2 
)

Definition at line 196 of file rect.cpp.

                  {
  if (op2.bot_left.x () < op1.bot_left.x ())
    op1.bot_left.set_x (op2.bot_left.x ());

  if (op2.top_right.x () > op1.top_right.x ())
    op1.top_right.set_x (op2.top_right.x ());

  if (op2.bot_left.y () < op1.bot_left.y ())
    op1.bot_left.set_y (op2.bot_left.y ());

  if (op2.top_right.y () > op1.top_right.y ())
    op1.top_right.set_y (op2.top_right.y ());

  return op1;
}