-
Notifications
You must be signed in to change notification settings - Fork 3
/
Point.cpp
61 lines (48 loc) · 1001 Bytes
/
Point.cpp
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
#include <iostream>
#include <cmath>
#include "Point.h"
using namespace std;
Point::Point(double x, double y, double z, unsigned ident) {
this -> x = x;
this -> y = y;
this -> z = z;
this -> ident = ident;
}
bool Point::operator==(Point rhs) {
if (abs(this->x - rhs.x) <= 1.0e-9 && abs(this->y - rhs.y) <= 1.0e-9 && abs(this->z - rhs.z) <= 1.0e-9) {
return true;
}
return false;
}
unsigned Point::getId() {
return this->ident;
}
Point* Point::setId(unsigned id) {
this->ident = id;
return this;
}
double Point::getX() {
return this->x;
}
Point* Point::setX(double x) {
this->x = x;
return this;
}
double Point::getY() {
return this->y;
}
Point* Point::setY(double y) {
this->y = y;
return this;
}
double Point::getZ() {
return this->z;
}
Point* Point::setZ(double z) {
this->z = z;
return this;
}
void Point::print()
{
cout << this -> x << " " << this -> y << " " << this -> z << "\n" << endl;
}