aboutsummaryrefslogtreecommitdiff
path: root/XY.cpp
blob: ad1262b99a7ce24a81926fc94b66464330ab8f03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "XY.h"

XY XY::operator - () const {
	return XY {
		.x = -x,
		.y = -y,
	};
}

XY XY::operator + (const XY & rhs) const {
	return XY {
		.x = x + rhs.x,
		.y = y + rhs.y,
	};
}

XY XY::operator - (const XY & rhs) const {
	return XY {
		.x = x - rhs.x,
		.y = y - rhs.y,
	};
}

XY& XY::operator += (const XY & rhs) {
	this->x += rhs.x;
	this->y += rhs.y;
	return *this;
}

XY& XY::operator -= (const XY & rhs) {
	this->x -= rhs.x;
	this->y -= rhs.y;
	return *this;
}