-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulation.h
executable file
·56 lines (41 loc) · 1.23 KB
/
simulation.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef SIMULATION_H
#define SIMULATION_H
#include <Eigen/Core>
#include <Eigen/Sparse>
#include <vector>
#include <set>
#include <QMutex>
#include "renderer.h"
#include "rigidbodyinstance.h"
typedef Eigen::Triplet<double> Tr;
struct SimParameters;
class HairInstance;
class Simulation
{
public:
Simulation(const SimParameters ¶ms);
void addParticle(double x, double y);
void addSaw(double x, double y);
void takeSimulationStep();
void takeBakeStep();
void render(bool is3D);
void bakeRender(bool is3D);
void clearScene();
std::vector<HairInstance*> hairs_;
std::vector<HairInstance*> interpHairs_;
std::vector<RigidBodyInstance*> bodies_;
double getTime() { return time_; };
private:
const SimParameters ¶ms_;
Renderer* renderer;
QMutex renderLock_;
double time_;
void buildConfiguration(Eigen::VectorXd &q, Eigen::VectorXd &qprev, Eigen::VectorXd &v);
void unbuildConfiguration(const Eigen::VectorXd &q, const Eigen::VectorXd &v);
void createInterpolations();
void cleanInterpolations();
void bakeHairs();
void numericalIntegration(Eigen::VectorXd &q, Eigen::VectorXd &qprev, Eigen::VectorXd &v);
void reconstruction();
};
#endif // SIMULATION_H