27 #include <initializer_list> 29 #include "swe_types.h" 40 Size() : w(0), h(0) {}
41 Size(
int sw,
int sh) : w(sw), h(sh) {}
42 Size(std::initializer_list<int>);
44 static Size parse(
const std::string &,
int sep =
'x');
46 bool isEmpty(
void)
const;
48 bool operator== (
const Size &)
const;
49 bool operator!= (
const Size &)
const;
50 bool operator<= (
const Size &)
const;
51 bool operator>= (
const Size &)
const;
61 Size operator* (
int)
const;
62 Size operator/ (
int)
const;
64 bool operator< (
const Size &)
const;
65 bool operator> (
const Size &)
const;
67 Size swap(
void)
const {
return Size(h, w); }
68 std::string toString(
void)
const;
76 Point() : x(0), y(0) {}
77 Point(
const Size & sz) : x(sz.w), y(sz.h) {}
78 Point(
int px,
int py) : x(px), y(py) {}
79 Point(std::initializer_list<int>);
81 static Point parse(
const std::string &,
int sep =
':');
83 bool isNull(
void)
const;
91 bool operator== (
const Point &)
const;
92 bool operator!= (
const Point &)
const;
102 Point operator* (
int)
const;
103 Point operator/ (
int)
const;
105 Point swap(
void)
const {
return Point(y, x); }
106 Size toSize(
void)
const {
return Size(x, y); }
108 std::string toString(
void)
const;
120 ZPoint(
int px,
int py,
int pz) :
Point(px, py), z(pz) {}
122 ZPoint(std::initializer_list<int>);
124 static ZPoint parse(
const std::string &,
int sep =
':');
126 bool operator== (
const ZPoint &)
const;
127 bool operator!= (
const ZPoint &)
const;
137 ZPoint operator* (
int)
const;
138 ZPoint operator/ (
int)
const;
140 std::string toString(
void)
const;
147 Rect(
int,
int,
int,
int);
150 Rect(
const SDL_Rect &);
151 Rect(std::initializer_list<int>);
153 bool operator== (
const Rect &)
const;
154 bool operator!= (
const Rect &)
const;
158 Rect operator+ (
const Size &)
const;
159 Rect operator- (
const Size &)
const;
160 Rect operator+ (
const Rect &)
const;
161 Rect operator- (
const Rect &)
const;
163 Point topLeft(
void)
const;
164 Point topRight(
void)
const;
165 Point bottomLeft(
void)
const;
166 Point bottomRight(
void)
const;
168 void setPoint(
const Point &);
169 void setSize(
const Size &);
170 Rect swapSize(
void)
const {
return Rect(x, y, h, w); }
172 Point toPoint(
void)
const;
173 Size toSize(
void)
const;
175 SDL_Rect toSDLRect(
void)
const;
177 Rect intersected(
const Rect &)
const;
178 bool intersects(
const Rect &)
const;
179 bool contains(
const Point &)
const;
180 bool contains(
const Rect &)
const;
190 std::string toString(
void)
const;
197 Points(
const std::vector<Point> & v) : std::vector<Point>(v) {}
206 assign(v.begin(), v.end());
215 Rect around(
void)
const;
223 std::string toString(
void)
const;
229 Rects(
const std::vector<Rect> & v) : std::vector<Rect>(v) {}
230 Rects(
const Rects & v) : std::vector<Rect>(v) {}
238 assign(v.begin(), v.end());
247 int index(
const Point &)
const;
248 Rect around(
void)
const;
256 std::string toString(
void)
const;
264 bool operator& (
const Point &)
const;
static bool intersection(const Rect &, const Rect &, Rect *res=nullptr)
функция проверки пересечения Rect c Rect.
Definition: swe_rect.cpp:552
пространство SWE.
Definition: swe_binarybuf.cpp:30
класс прямоугольника
Definition: swe_rect.h:144
Definition: swe_rect.h:259
bool inABC(const Point &A, const Point &B, const Point &C) const
функция определения включения объекта Point в треугольник
Definition: swe_rect.cpp:72
класс точки с двумя координатами
Definition: swe_rect.h:72
класс последовательности точек
Definition: swe_rect.h:194
bool operator &(const Point &) const
функция проверки включения Point в Rect.
класс точки с тремя координатами
Definition: swe_rect.h:115
static int distance(const Point &, const Point &)
функция определения расстояния по двум точкам
Definition: swe_rect.cpp:135
класс двухмерной размерности
Definition: swe_rect.h:36
Definition: swe_rect.h:226