-
Notifications
You must be signed in to change notification settings - Fork 0
/
hE3initstategeometrycirc.h
87 lines (60 loc) · 1.81 KB
/
hE3initstategeometrycirc.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
// Circular geometry
// Circumference: centered at r0, radius RADIUS in units, particles-radius=R in px.
// Arc-distance between particles = dl
vector<istate> getistatesmcirc(par r0, par v0, double m, double q, bool selfcolor, ALLEGRO_COLOR scolor, double dl, double RADIUS, double R)
{
vector<istate> matrix;
// Temporary state for initialization
istate tmp;
matrix.clear();
// GEOMETRICAL INITIAL CONFIGURATION
// Angle in radians
double fita = 0;
// Number of pieces
double n = (2 * PI*RADIUS) / dl;
double i = 0;
// Points of the circunference
par ri;
for (i = 0; i < n; i++)
{
fita = (i)*(dl / RADIUS);
ri = r0 + polar(RADIUS, fita);
tmp = getpixstate(ri, v0, m, q, selfcolor, scolor, R);
matrix.push_back(tmp);
}
return matrix;
}
// n Circumferences: First centered at r0, second: r1, third: r2, ...
vector<istate> getistatesmncirc(par r0, par v0, double m, double q, bool selfcolor, ALLEGRO_COLOR scolor, double dl, double RADIUS, double R, int n, ...)
{
// n extra parameters: r1, r2, r3, ....
vector<istate> matrix;
// Initial circumference
matrix = getistatesmcirc(r0, v0, m, q, selfcolor, scolor, dl, RADIUS, R);
// Reading centers for n circumferences: r1, r2, r3, ...
vector<par> centers;
centers.clear();
par _tmp;
va_list valist;
va_start(valist, n);
int _i = 0;
for (_i = 0; _i < n; _i++)
{
_tmp = va_arg(valist, par);
centers.push_back(_tmp);
}
va_end(valist);
vector<istate> tmp_m;
vector<istate> sum_m;
int k = 0;
vector<par>::iterator it;
for (it = centers.begin(); it < centers.end(); it++)
{
k++;
tmp_m = getistatesmcirc(*it, v0, m, q, selfcolor, scolor, dl, RADIUS, R);
sum_m = sumistatesm(matrix, tmp_m);
matrix = sum_m;
}
return matrix;
}