summaryrefslogtreecommitdiff
path: root/src/gui/Main.cc
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2011-04-13 13:26:54 +0000
committerJakob Odersky <jodersky@gmail.com>2011-04-13 13:26:54 +0000
commita0ced12c6a243ac4acf68500ae71688cd851fcda (patch)
tree2d08bdfdd635eb9e00913902df2a5c3736c479f3 /src/gui/Main.cc
parentd4c30f04e6b84df2d88841f1544d16ef9973ffb1 (diff)
downloadvhc-a0ced12c6a243ac4acf68500ae71688cd851fcda.tar.gz
vhc-a0ced12c6a243ac4acf68500ae71688cd851fcda.tar.bz2
vhc-a0ced12c6a243ac4acf68500ae71688cd851fcda.zip
version amelioree de l'interface graphique
Diffstat (limited to 'src/gui/Main.cc')
-rw-r--r--src/gui/Main.cc50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/gui/Main.cc b/src/gui/Main.cc
index c96b8f4..f0eb3cd 100644
--- a/src/gui/Main.cc
+++ b/src/gui/Main.cc
@@ -13,7 +13,25 @@
#include "StraightElement.h"
#include "Dipole.h"
#include "Particle.h"
+#include "FODO.h"
#include "Vector3D.h"
+#include <vector>
+
+using namespace vhc;
+
+std::vector< Particle > createParticles(const Vector3D& position, int n) {
+ std::vector< Particle > v;
+
+ for (int i = 0; i < n; ++i) {
+ double x = (rand() % 100) / 1000.0;
+ double y = (rand() % 100) / 1000.0;
+ double z = (rand() % 100) / 1000.0;
+ v.push_back(Particle(position + Vector3D(x, y, z), 1, 1));
+ }
+
+ return v;
+}
+
int main(int argc, char *argv[])
@@ -29,11 +47,37 @@ int main(int argc, char *argv[])
accelerator.add(se2);
accelerator.add(*ce);
- vhc::Particle p(se.getEntryPosition(), 1, 1);
- accelerator.add(p);
+ FODO e1 = FODO(Vector3D(3, 2, 0), Vector3D(3, -2, 0), 0.2, 1.0, 5.0);
+ Dipole e2 = Dipole(e1.getExitPosition(), Vector3D(2, -3, 0), 0.2, 1);
+ FODO e3 = FODO(e2.getExitPosition(), Vector3D(-2, -3, 0), 0.2, 1, 5.0);
+ Dipole e4 = Dipole(e3.getExitPosition(), Vector3D(-3, -2, 0), 0.2, 1);
+ FODO e5 = FODO(e4.getExitPosition(), Vector3D(-3, 2, 0), 0.2, 1.0, 5.0);
+ Dipole e6 = Dipole(e5.getExitPosition(), Vector3D(-2, 3, 0), 0.2, 1);
+ FODO e7 = FODO(e6.getExitPosition(), Vector3D(2, 3, 0), 0.2, 1.0, 5.0);
+ Dipole e8 = Dipole(e7.getExitPosition(), e1.getEntryPosition(), 0.2, 1);
+ Accelerator acc;
+ acc.add(e1);
+ acc.add(e2);
+ acc.add(e3);
+ acc.add(e4);
+ acc.add(e5);
+ acc.add(e6);
+ acc.add(e7);
+ acc.add(e8);
+
+
+ vhc::Particle p(e1.getEntryPosition(), 1, 1);
+ acc.add(p);
+
+ std::vector< Particle > ps = createParticles(e1.getEntryPosition(), 1000);
+
+ for (int i = 0; i < ps.size(); ++i) {
+ acc.add(ps[i]);
+ }
+
vhc::Stage window;
- window.accelerator = &accelerator;
+ window.accelerator = &acc;
window.showFullScreen();
//window.resize(QSize(500, 500));