-
Notifications
You must be signed in to change notification settings - Fork 1
/
point3d.cpp
53 lines (46 loc) · 929 Bytes
/
point3d.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
#include "point3d.h"
#include "math.h"
Point3d::Point3d(){
x = 0;
y = 0;
z = 0;
}
Point3d::Point3d(float newx, float newy, float newz){
x = newx;
y = newy;
z = newz;
}
Point3d::~Point3d(){
}
float Point3d::GetAbsis(){
return x;
}
float Point3d::GetOrdinat(){
return y;
}
float Point3d::GetZ(){
return z;
}
void Point3d::SetAbsis(int newx){
this->x = newx;
}
void Point3d::SetOrdinat(int newy){
this->y = newy;
}
void Point3d::SetZ(int newz){
this->z = newz;
}
int Point3d::IsOrigin(){
if (x == 0 && y ==0 && z == 0){
return 1;
} else {return 0;}
}
int Point3d::IsEqual(Point3d P){
if (this->x == P.GetAbsis() && this->y == P.GetOrdinat() && this->z == P.GetZ()){
return 1;
} else {return 0;}
}
float Point3d::AntarPoint(Point3d P1, Point3d P2){
float hasil = sqrt(pow((P2.GetAbsis() - P1.GetAbsis()),2) + pow((P2.GetOrdinat() - P1.GetOrdinat()),2) + pow((P2.GetZ() - P1.GetZ()),2));
return hasil;
}