-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.cpp
More file actions
42 lines (33 loc) · 714 Bytes
/
Copy pathpoint.cpp
File metadata and controls
42 lines (33 loc) · 714 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
#include <iostream>
#include "math.h"
#include "point.hpp"
Point::Point(){
//x= 40;
}
Point::Point(const float x, const float y, const float z){
this->x = x;
this->y = y;
this->z = z;
}
void Point::afficher(std::ostream &flux) const
{
flux << "Point: " << "x :"<< x << " y:" << y << " z:" << z << std::endl;
}
bool Point::estInfini() const
{
return (isinf(x) || isinf(y) || isinf(z));
}
float Point::distance(const Point other) const
{
float xx, yy, zz;
xx = x - other.x;
yy = y - other.y;
zz = z - other.z;
return sqrt(xx*xx + yy*yy + zz*zz);
}
float Point::norme(){
return sqrt(x*x + y*y + z*z);
}
float Point::scalaire(const Point other){
return x*other.x + y*other.y + z*other.z;
}