-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtpoint.cpp
74 lines (53 loc) · 1.18 KB
/
rtpoint.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
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "rtpoint.h"
RTPoint::RTPoint()
{
}
RTPoint::RTPoint(double x,double y,double z){
this->x=x;
this->y=y;
this->z=z;
}
RTPoint::RTPoint(const RTPoint &point)
{
this->x = point.getX();
this->y = point.getY();
this->z = point.getZ();
}
RTVector RTPoint::operator+ (RTVector v){
double x= this->x+v.getX();
double y= this->y+v.getY();
double z= this->z+v.getZ();
RTVector p(x,y,z);
return p;
}
RTPoint RTPoint::operator- (RTVector v){
double x= this->x-v.getX();
double y= this->y-v.getY();
double z= this->z-v.getZ();
RTPoint p(x,y,z);
return p;
}
RTVector RTPoint::operator- (RTPoint p2){
double x= this->x-p2.getX();
double y= this->y-p2.getY();
double z= this->z-p2.getZ();
RTVector v(x,y,z);
return v;
}
RTVector RTPoint::operator *(double n)
{
double x= this->x*n;
double y= this->y*n;
double z= this->z*n;
RTVector r(x,y,z);
return r;
}
double RTPoint::getX() const {
return this->x;
}
double RTPoint::getY() const {
return this->y;
}
double RTPoint::getZ() const{
return this->z;
}