-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwriteframe.h
More file actions
48 lines (34 loc) · 1.18 KB
/
Copy pathwriteframe.h
File metadata and controls
48 lines (34 loc) · 1.18 KB
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
//
// Created by ziyinqu on 10/1/17.
//
#pragma once
#ifndef MPM_WRITEFRAME_H
#define MPM_WRITEFRAME_H
#include <string>
#include "global.h"
using namespace std;
void saveStep(vector<Particle> particles, int step){
//Write to an object file
ofstream outfile;
//later we'll want a second parameter, timeStep to make it spit out differently named files!
string filename = "Output/step" + to_string(step) + ".obj";
outfile.open(filename);
for(int i = 0; i < particles.size(); i++){
outfile << "v " << particles[i].posP[0] << " " << particles[i].posP[1] << " " << particles[i].posP[2] << "\n";
}
outfile.close();
return;
}
void saveFrame(vector<Particle> particles, int frame){
//Write to an object file
ofstream outfile;
//later we'll want a second parameter, timeStep to make it spit out differently named files!
string filename = "Output/frame" + to_string(frame) + ".obj";
outfile.open(filename);
for(int i = 0; i < particles.size(); i++){
outfile << "v " << particles[i].posP[0] << " " << particles[i].posP[1] << " " << particles[i].posP[2] << "\n";
}
outfile.close();
return;
}
#endif //MPM_WRITEFRAME_H