24 #include "config_auto.h" 36 if (pt1.
x () <= pt2.
x ()) {
37 if (pt1.
y () <= pt2.
y ()) {
42 bot_left =
ICOORD (pt1.
x (), pt2.
y ());
43 top_right =
ICOORD (pt2.
x (), pt1.
y ());
47 if (pt1.
y () <= pt2.
y ()) {
48 bot_left =
ICOORD (pt2.
x (), pt1.
y ());
49 top_right =
ICOORD (pt1.
x (), pt2.
y ());
65 int16_t left, int16_t bottom, int16_t right, int16_t top)
66 : bot_left(left, bottom), top_right(right, top) {
73 ICOORD top_left(bot_left.
x(), top_right.
y());
74 ICOORD bottom_right(top_right.
x(), bot_left.
y());
76 bottom_right.rotate(vec);
78 TBOX box2(top_left, bottom_right);
88 const TBOX &box)
const {
94 if (box.bot_left.
x () > bot_left.
x ())
95 left = box.bot_left.
x ();
99 if (box.top_right.
x () < top_right.
x ())
100 right = box.top_right.
x ();
104 if (box.bot_left.
y () > bot_left.
y ())
109 if (box.top_right.
y () < top_right.
y ())
110 top = box.top_right.
y ();
112 top = top_right.
y ();
130 const TBOX &box)
const {
134 if (box.bot_left.
x () < bot_left.
x ())
135 bl.
set_x (box.bot_left.
x ());
139 if (box.top_right.
x () > top_right.
x ())
140 tr.
set_x (box.top_right.
x ());
142 tr.
set_x (top_right.
x ());
144 if (box.bot_left.
y () < bot_left.
y ())
145 bl.
set_y (box.bot_left.
y ());
149 if (box.top_right.
y () > top_right.
y ())
150 tr.
set_y (box.top_right.
y ());
152 tr.
set_y (top_right.
y ());
153 return TBOX (bl, tr);
162 #ifndef GRAPHICS_DISABLED 168 fd->
Brush(fill_colour);
169 fd->
Pen(border_colour);
186 if (!bot_left.
Serialize(fp))
return false;
187 if (!top_right.
Serialize(fp))
return false;
194 if (!top_right.
DeSerialize(swap, fp))
return false;
208 if (op2.bot_left.
x () < op1.bot_left.
x ())
209 op1.bot_left.
set_x (op2.bot_left.
x ());
211 if (op2.top_right.
x () > op1.top_right.
x ())
212 op1.top_right.
set_x (op2.top_right.
x ());
214 if (op2.bot_left.
y () < op1.bot_left.
y ())
215 op1.bot_left.
set_y (op2.bot_left.
y ());
217 if (op2.top_right.
y () > op1.top_right.
y ())
218 op1.top_right.
set_y (op2.top_right.
y ());
232 if (op2.bot_left.
x () > op1.bot_left.
x ())
233 op1.bot_left.
set_x (op2.bot_left.
x ());
235 if (op2.top_right.
x () < op1.top_right.
x ())
236 op1.top_right.
set_x (op2.top_right.
x ());
238 if (op2.bot_left.
y () > op1.bot_left.
y ())
239 op1.bot_left.
set_y (op2.bot_left.
y ());
241 if (op2.top_right.
y () < op1.top_right.
y ())
242 op1.top_right.
set_y (op2.top_right.
y ());
245 op1.bot_left.
set_x (INT16_MAX);
246 op1.bot_left.
set_y (INT16_MAX);
247 op1.top_right.
set_x (-INT16_MAX);
248 op1.top_right.
set_y (-INT16_MAX);
254 return (abs(
left() - box.
left()) <= tolerance &&
259 return (abs(
left() - box.
left()) <= tolerance &&
261 abs(
top() - box.
top()) <= tolerance &&
bool Serialize(FILE *fp) const
void rotate(const FCOORD &vec)
bool almost_equal(const TBOX &box, int tolerance) const
TBOX intersection(const TBOX &box) const
void set_x(int16_t xin)
rewrite function
int16_t y() const
access_function
bool DeSerialize(bool swap, FILE *fp)
void plot(ScrollView *fd) const
int16_t x() const
access function
DLLSYM TBOX & operator+=(TBOX &op1, const TBOX &op2)
bool Serialize(FILE *fp) const
void rotate_large(const FCOORD &vec)
bool x_almost_equal(const TBOX &box, int tolerance) const
void rotate(const FCOORD &vec)
void add_str_int(const char *str, int number)
bool overlap(const TBOX &box) const
TBOX bounding_union(const TBOX &box) const
TBOX & operator &=(TBOX &op1, const TBOX &op2)
void set_y(int16_t yin)
rewrite function
void print_to_str(STRING *str) const
bool DeSerialize(bool swap, FILE *fp)