Graphic Calculator: FIDocalcus
Проект трёх первокурсников (по инженерному практикуму в первом семестре) по созданию графического калькулятора на FLTK C++
Loading...
Searching...
No Matches
Point.h
Go to the documentation of this file.
1#pragma once
2
3using pix_amount = unsigned int;
4
5namespace Graph_lib {
6
7struct Point {
8 inline Point() : x{0}, y{0} {}
9
10 inline constexpr Point(pix_amount _x, pix_amount _y) : x{_x}, y{_y} {}
11
12 // methods
13
14 inline Point& operator+=(Point d) {
15 x += d.x;
16 y += d.y;
17 return *this;
18 }
19
20 inline Point& operator-=(Point d) {
21 x -= d.x;
22 y -= d.y;
23 return *this;
24 }
25
26 // ~methods
27
28 // vars
29
31
32 // ~vars
33};
34
35inline Point operator+(Point a, Point b) { return a += b; }
36
37inline Point operator-(Point a, Point b) { return a -= b; }
38
39inline bool operator==(Point a, Point b) { return a.x == b.x && a.y == b.y; }
40
41inline bool operator!=(Point a, Point b) { return !(a == b); }
42
43} // namespace Graph_lib
unsigned int pix_amount
Definition Point.h:3
Definition Point.h:5
Point operator+(Point a, Point b)
Definition Point.h:35
bool operator==(Point a, Point b)
Definition Point.h:39
Point operator-(Point a, Point b)
Definition Point.h:37
bool operator!=(Point a, Point b)
Definition Point.h:41
Definition Point.h:7
Point & operator+=(Point d)
Definition Point.h:14
Point & operator-=(Point d)
Definition Point.h:20
Point()
Definition Point.h:8
pix_amount y
Definition Point.h:30
constexpr Point(pix_amount _x, pix_amount _y)
Definition Point.h:10
pix_amount x
Definition Point.h:30