-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.cpp
66 lines (52 loc) · 942 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
62
63
64
65
66
#include "Point.hpp"
#include <iostream>
#include <math.h>
Point::Point(){
std::cout << "Contructeur par défaut" << std::endl;
compteur++;
}
Point::Point(int i){
std::cout << "Constructeur 1" << std::endl;
x = 0;
y = 0;
z = 0;
compteur++;
}
Point::~Point(){
compteur--;
}
int Point::compteur = 0;
void Point::setX(int v1){
x = v1;
}
void Point::setY(int v2){
y = v2;
}
void Point::setZ(int v3){
z = v3;
}
int Point::getX(){
return x;
}
int Point::getY(){
return y;
}
int Point::getZ(){
return z;
}
void Point::deplacerDe(int x1, int y1, int z1){
x+=x1;
y+=y1;
z+=z1;
}
void Point::deplacerVers(int x1, int y1, int z1){
x=x1;
y=y1;
z=z1;
}
double distanceEuclidienne(Point p1, Point p2){
return sqrt(pow((p1.getX()-p2.getX()),2) + pow((p1.getY()-p2.getY()),2) + pow((p1.getZ()-p2.getZ()),2));
}
int Point::getCompteur(){
return compteur;
}