-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.h
42 lines (38 loc) · 973 Bytes
/
solution.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
#pragma once
#include <complex>
#include <vector>
#include <fstream>
#include "base/base.h"
#include "boost/multiprecision/cpp_int.hpp"
#include "boost/rational.hpp"
#include "polygon.h"
using boost::rational;
using boost::rational_cast;
struct Solution {
vector<Vertex> src_verts;
vector<Vertex> dst_verts;
vector<vector<int>> facets;
};
void ReadSolution(std::istream& is, Solution* solution) {
int n_verts;
CHECK(is >> n_verts);
solution->src_verts.resize(n_verts);
for (int i = 0; i < n_verts; ++i) {
is >> solution->src_verts[i];
}
int n_facets;
CHECK(is >> n_facets);
solution->facets.resize(n_facets);
for (int i = 0; i < n_facets; ++i) {
int n_indices;
CHECK(is >> n_indices);
solution->facets[i].resize(n_indices);
for (int j = 0; j < n_indices; ++j) {
is >> solution->facets[i][j];
}
}
solution->dst_verts.resize(n_verts);
for (int i = 0; i < n_verts; ++i) {
is >> solution->dst_verts[i];
}
}