diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2020-02-18 18:59:05 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2020-02-18 18:59:05 -0500 |
commit | 3a3f2dd3b2c47d9d89ed29b7039e39626f2dcf72 (patch) | |
tree | c44e9ab0057bb2bc2c8ec4794dfb4b5b6fb8cd30 /spheres_infinite.cpp | |
parent | 2ebf2f181edac37bfb932dbb353101e37e97223a (diff) | |
download | space_wolff-3a3f2dd3b2c47d9d89ed29b7039e39626f2dcf72.tar.gz space_wolff-3a3f2dd3b2c47d9d89ed29b7039e39626f2dcf72.tar.bz2 space_wolff-3a3f2dd3b2c47d9d89ed29b7039e39626f2dcf72.zip |
Cleaned up Transformation system and sped things up generally
Diffstat (limited to 'spheres_infinite.cpp')
-rw-r--r-- | spheres_infinite.cpp | 38 |
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); |