forked from codysauermann/GeometricDataStructures2D
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimplePoint2D.cpp
More file actions
80 lines (66 loc) · 1.41 KB
/
SimplePoint2D.cpp
File metadata and controls
80 lines (66 loc) · 1.41 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "SimplePoint2D.h"
SimplePoint2D::SimplePoint2D()
{
this->x = "0";
this->y = "0";
}
SimplePoint2D::SimplePoint2D(const SimplePoint2D& p)
{
this->x = p.x;
this->y = p.y;
}
SimplePoint2D::SimplePoint2D(Number x, Number y)
{
this->x = x;
this->y = y;
}
SimplePoint2D::SimplePoint2D(SimplePoint2D&& p)
{
this->x = std::move(p.x);
this->y = std::move(p.y);
}
SimplePoint2D& SimplePoint2D::operator=(const SimplePoint2D& p)
{
this->x = p.x;
this->y = p.y;
return *this;
}
SimplePoint2D& SimplePoint2D::operator=(SimplePoint2D&& p)
{
this->x = std::move(p.x);
this->y = std::move(p.y);
return *this;
}
bool SimplePoint2D::operator<(const SimplePoint2D& p)
{
if ((*this).x < p.x)
return true;
else
return ((*this).x == p.x && (*this).y < p.y);
}
bool SimplePoint2D::operator<=(const SimplePoint2D& p)
{
return (*this < p || *this == p);
}
bool SimplePoint2D::operator==(const SimplePoint2D& p)
{
return ((*this).x == p.x && (*this).y == p.y);
}
bool SimplePoint2D::operator>=(const SimplePoint2D& p)
{
return !((*this) < p);
}
bool SimplePoint2D::operator>(const SimplePoint2D& p)
{
return !((*this) <= p);
}
bool SimplePoint2D::operator!=(const SimplePoint2D& p)
{
return !((*this) == p);
}
SimplePoint2D& SimplePoint2D::operator=(SimplePoint2D&& p)
{
this->x = std::move(p.x);
this->y = std::move(p.y);
return *this;
}