summaryrefslogtreecommitdiff
path: root/spheres_infinite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'spheres_infinite.cpp')
-rw-r--r--spheres_infinite.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp
index 77a3582..e41ea17 100644
--- a/spheres_infinite.cpp
+++ b/spheres_infinite.cpp
@@ -14,10 +14,11 @@ private:
uint64_t t2;
unsigned n;
unsigned tmp;
+ unsigned wait;
Euclidean<double, D> s0_tmp;
public:
- animation(double L, unsigned w, int argc, char* argv[]) : s0_tmp(0) {
+ animation(double L, unsigned w, int argc, char* argv[]) : s0_tmp(0), wait(1000) {
t1 = 0;
t2 = 0;
n = 0;
@@ -25,7 +26,7 @@ public:
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(w, w);
- glutCreateWindow("wolff");
+ glutCreateWindow("wolffWindow");
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -33,7 +34,7 @@ public:
}
void plain_site_transformed(const model& m, const Transformation<double, D, Euclidean<double, D>, double>& t) override {
- if (n > 5000) {
+ if (n > wait) {
if (t.current().size() > 1) {
glColor3f(0.0f, 0.0f, 1.0f);
} else {
@@ -81,7 +82,7 @@ public:
glFlush();
t1 += tmp;
t2 += tmp * tmp;
- if (n > 5000) {
+ if (n > wait) {
sleep(2);
}
n++;
@@ -124,28 +125,31 @@ Gen<double, D, Euclidean<double, D>, double> mGen(double ε) {
Spin<double, D, double>* s1 = rng.pick(M.s);
Spin<double, D, double>* s2 = rng.pick(M.s);
- Vector<double, D> t1 = s1->x;
- Vector<double, D> t2 = s2->x;
- Vector<double, D> t12 = t1 - t2;
- while (s1 == s2 || 1 / t12.norm() < rng.uniform<double>(0, 1)) {
- s1 = rng.pick(M.s);
- s2 = rng.pick(M.s);
- t1 = s1->x;
- t2 = s2->x;
- t12 = t1 - t2;
+ while (s1 == s2) {
+ s2 = rng.pick(M.s);
}
+ Vector<double, D> t1 = s1->x;
+ Vector<double, D> t2 = s2->x;
+ Vector<double, D> t12 = t1 - t2;
Vector<double, D> t = (t1 + t2) / 2;
- double θ = atan2(t12[1], t12[0]) + rng.variate<double, std::normal_distribution>(0.0, ε) / t12.norm();
+ double θ = atan2(t12(1), t12(0)) + rng.variate<double, std::normal_distribution>(0.0, ε) / t12.norm();
m(0, 0) = -cos(2 * θ);
m(1, 1) = cos(2 * θ);
m(0, 1) = -2 * cos(θ) * sin(θ);
m(1, 0) = -2 * cos(θ) * sin(θ);
- Euclidean<double, D> g(t - m * t, m);
+ Vector<double, D> t3 = t - m * t;
+
+ if (t3(0) != t3(0)) {
+ std::cout << t3 << "\n" << t << "\n" << m << "\n" << t12 << "\n" ;
+ getchar();
+ }
+
+ Euclidean<double, D> g(t3, m);
return new PairFlip<double, D, Euclidean<double, D>, double>(M, g, s1, s2);
};
}
@@ -234,8 +238,8 @@ int main(int argc, char* argv[]) {
return H * s.x.norm();
};
- auto g1 = eGen(0.5);
- auto g2 = mGen(0.05);
+ auto g1 = eGen(1);
+ auto g2 = mGen(0.1);
auto g3 = rGen(1);
animation A(L, 750, argc, argv);
model sphere(1.0, Z, B);