21# include "config_auto.h"
39 if (pt1.
x() <= pt2.
x()) {
40 if (pt1.
y() <= pt2.
y()) {
45 top_right =
ICOORD(pt2.
x(), pt1.
y());
48 if (pt1.
y() <= pt2.
y()) {
50 top_right =
ICOORD(pt1.
x(), pt2.
y());
70 ICOORD top_left(bot_left.
x(), top_right.
y());
71 ICOORD bottom_right(top_right.
x(), bot_left.
y());
75 TBOX box2(top_left, bottom_right);
85 const TBOX &box)
const {
91 if (box.bot_left.
x() > bot_left.
x()) {
92 left = box.bot_left.
x();
97 if (box.top_right.
x() < top_right.
x()) {
103 if (box.bot_left.
y() > bot_left.
y()) {
109 if (box.top_right.
y() < top_right.
y()) {
110 top = box.top_right.
y();
129 const TBOX &box)
const {
133 if (box.bot_left.
x() < bot_left.
x()) {
134 bl.
set_x(box.bot_left.
x());
139 if (box.top_right.
x() > top_right.
x()) {
140 tr.
set_x(box.top_right.
x());
145 if (box.bot_left.
y() < bot_left.
y()) {
146 bl.
set_y(box.bot_left.
y());
151 if (box.top_right.
y() > top_right.
y()) {
152 tr.
set_y(box.top_right.
y());
164#ifndef GRAPHICS_DISABLED
170 fd->
Brush(fill_colour);
171 fd->
Pen(border_colour);
179 str +=
"(" + std::to_string(
left());
180 str +=
"," + std::to_string(
bottom());
181 str +=
")->(" + std::to_string(
right());
182 str +=
"," + std::to_string(
top());
217 if (op2.bot_left.
x() < op1.bot_left.
x()) {
218 op1.bot_left.
set_x(op2.bot_left.
x());
221 if (op2.top_right.
x() > op1.top_right.
x()) {
222 op1.top_right.
set_x(op2.top_right.
x());
225 if (op2.bot_left.
y() < op1.bot_left.
y()) {
226 op1.bot_left.
set_y(op2.bot_left.
y());
229 if (op2.top_right.
y() > op1.top_right.
y()) {
230 op1.top_right.
set_y(op2.top_right.
y());
244 if (op2.bot_left.
x() > op1.bot_left.
x()) {
245 op1.bot_left.
set_x(op2.bot_left.
x());
248 if (op2.top_right.
x() < op1.top_right.
x()) {
249 op1.top_right.
set_x(op2.top_right.
x());
252 if (op2.bot_left.
y() > op1.bot_left.
y()) {
253 op1.bot_left.
set_y(op2.bot_left.
y());
256 if (op2.top_right.
y() < op1.top_right.
y()) {
257 op1.top_right.
set_y(op2.top_right.
y());
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);
269 return (abs(
left() - box.
left()) <= tolerance && abs(
right() - box.
right()) <= tolerance);
273 return (abs(
left() - box.
left()) <= tolerance && abs(
right() - box.
right()) <= tolerance &&
ICOORD & operator+=(ICOORD &op1, const ICOORD &op2)
TBOX & operator&=(TBOX &op1, const TBOX &op2)
void rotate(const FCOORD &vec)
void set_x(TDimension xin)
rewrite function
TDimension y() const
access_function
bool DeSerialize(TFile *f)
void set_y(TDimension yin)
rewrite function
TDimension x() const
access function
bool Serialize(TFile *f) const
void print_to_str(std::string &str) const
bool x_almost_equal(const TBOX &box, int tolerance) const
bool almost_equal(const TBOX &box, int tolerance) const
bool Serialize(FILE *fp) const
bool DeSerialize(bool swap, FILE *fp)
void rotate(const FCOORD &vec)
TBOX bounding_union(const TBOX &box) const
TBOX intersection(const TBOX &box) const
void rotate_large(const FCOORD &vec)
bool overlap(const TBOX &box) const
TDimension bottom() const
void plot(ScrollView *fd) const