-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.cpp
More file actions
46 lines (38 loc) · 853 Bytes
/
Copy pathpoint.cpp
File metadata and controls
46 lines (38 loc) · 853 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
43
44
45
46
#include "point.h"
#include <QtOpenGL>
void glVertex3p(point _P)
{
glVertex2f(_P.x, _P.y/*, _P.z*/);
}
float point::module()
{
return sqrt(x*x + y*y/* + z*z*/);
}
float point::moduleXY()
{
return sqrt(x*x + y*y);
}
float point::sqrmodule()
{
return (x*x + y*y);
}
point::point(const double &_x, const double &_y/*, double _z*/):x(_x), y(_y)/*, z(_z), enabled(false)*/{}
point point::operator+(const point &b)
{
return point(x + b.x, y + b.y/*, z + b.z*/);
}
point point::operator-(const point &b)
{
return point(x - b.x, y - b.y/*, z - b.z*/);
}
point point::operator*(const double &c)
{
return point(c*x, c*y/*, c*z*/);
}
bool point::operator!=( const point& b)
{
if ((x != b.x) || (y != b.y) /*|| (z != b.z)*/)
return true;
else
return false;
}