-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.h
65 lines (50 loc) · 1.36 KB
/
model.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
57
58
59
60
61
62
63
64
65
// Definuje funkce pro práci s modelem a simulací
//====================================================
#ifndef _MODEL
#define _MODEL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include "gml/gml_parser.h"
#define MAX_LENGTH_LABEL 256
typedef struct {
float x,y;
}Vector2;
typedef struct {
unsigned int id;
float charge;
Vector2 position,velocity,force;
char szVertexName[MAX_LENGTH_LABEL];
SDL_Surface *VertexSurface;
}Vertex;
typedef struct {
Vertex* pFrom;
Vertex* pTo;
float value;
unsigned int idFrom,idTo;
}Edge;
typedef struct {
Vertex* pVertices;
Edge* pEdges;
unsigned int uCountEdges,uCountVertices;
}Model;
typedef struct {
char szFontFile[255];
SDL_Color innerCircle,outterCircle,lineColor,fontColor;
unsigned int uFontSize,uNodeRadius,uScreenWidth,uScreenHeight,uBPP,
uMaxSurfaceW,uMaxSurfaceH;
}GraphicCfg;
typedef struct {
float fDamping,fSpringConstant,fSimStep,fCoulombConstant;
unsigned int uMinimumKineticEnergy,uMinimumSpringLength;
}SimulationCfg;
int BuildModel(const char* szFile,Model* pModel);
void FreeModel(Model* pModel);
int CreateModelSurfaces(Model* pModel,GraphicCfg *Config);
void SetRandomLocations(Model* pModel,const GraphicCfg Config);
unsigned int SimulationStep(Model* pModel,const SimulationCfg Config);
#endif