-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.cpp
More file actions
76 lines (65 loc) · 958 Bytes
/
Point.cpp
File metadata and controls
76 lines (65 loc) · 958 Bytes
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
#include "Point.h"
#include <assert.h>
using namespace std;
Point::Point():vec(0,0,0)
{
id = 0;
adjoin.clear();
}
Point::Point(myVec3d _vec)
{
vec = _vec;
id = 0;
adjoin.clear();
}
Point::Point(double _x,double _y,double _z):vec(_x,_y,_z)
{
id = 0;
adjoin.clear();
}
Point::~Point()
{
}
int Point::getId()
{
return id;
}
void Point::setId(int _id)
{
id = _id;
}
bool Point::isAdjoin(int p)
{
for(vector<int>::iterator it = adjoin.begin();it != adjoin.end();++it)
{
if(*it == p) return true;
}
return false;
}
void Point::addAdjoin(int p)
{
assert(p != id);
if(isAdjoin(p))
{
return;
}
adjoin.push_back(p);
}
void Point::noCheckAddAdjoin(int p)
{
adjoin.push_back(p);
}
void Point::removeAdjoin(int p)
{
for (vector<int>::iterator it = adjoin.begin(); it != adjoin.end(); ++it)
{
if ((*it) == p) {
adjoin.erase(it);
return;
}
}
}
bool operator==(const Point& a,const Point& b)
{
return (bool)(a.id == b.id);
}