-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMesh.cpp
51 lines (40 loc) · 1.29 KB
/
Mesh.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
#include <vector>
#include "Triangle.h"
#include "Mesh.h"
#include <iostream>
#include <iomanip>
#include "Helpers.h"
using namespace std;
Mesh::Mesh() {}
Mesh::Mesh(int meshId, int type, int numberOfTransformations,
vector<int> transformationIds,
vector<char> transformationTypes,
int numberOfTriangles,
vector<Triangle> triangles)
{
this->meshId = meshId;
this->type = type;
this->numberOfTransformations = numberOfTransformations;
this->numberOfTriangles = numberOfTriangles;
this->transformationIds = transformationIds;
this->transformationTypes = transformationTypes;
this->triangles = triangles;
}
ostream &operator<<(ostream &os, const Mesh &m)
{
os << "Mesh " << m.meshId;
if (m.type == 0)
{
os << " wireframe(0) with ";
}
else
{
os << " solid(1) with ";
}
os << fixed << setprecision(3) << m.numberOfTransformations << " transformations and " << m.numberOfTriangles << " triangles"
<< endl << "\tTriangles are:" << endl << fixed << setprecision(0);
for (size_t i = 0; i < m.triangles.size(); i++) {
os << "\t\t" << m.triangles[i].vertexIds[0] << " " << m.triangles[i].vertexIds[1] << " " << m.triangles[i].vertexIds[2] << endl;
}
return os;
}