-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertex.h
42 lines (36 loc) · 874 Bytes
/
vertex.h
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
#ifndef VECTOR_H
#define VECTOR_H
#include <QList>
#include <iostream>
struct Vertex{
double x = 0.0;
double y = 0.0;
double z = 0.0;
Vertex(){}
Vertex(double x, double y, double z){
this->x = x;
this->y = y;
this->z = z;
}
inline Vertex operator*(double rhs) {
return Vertex(x*rhs, y*rhs, z*rhs);
}
inline Vertex operator+(Vertex rhs) {
return Vertex(x+rhs.x, y+rhs.y, z+rhs.z);
}
QString to_string(){
QString value = "";
value += "x: " + QString::number(x);
value += " y: " + QString::number(y);
value += " z: " + QString::number(z);
return value;
}
QList<double> get_xyz(){
QList<double> retVal;
retVal.append(x);
retVal.append(y);
retVal.append(z);
return retVal;
}
};
#endif // VECTOR_H