From 3a3f2dd3b2c47d9d89ed29b7039e39626f2dcf72 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 18 Feb 2020 18:59:05 -0500 Subject: Cleaned up Transformation system and sped things up generally --- spheres_infinite.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'spheres_infinite.cpp') 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 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>& 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> mGen(double ε) { Spin* s1 = rng.pick(M.s); Spin* s2 = rng.pick(M.s); - Vector t1 = s1->x; - Vector t2 = s2->x; - Vector t12 = t1 - t2; - while (s1 == s2 || 1 / t12.norm() < rng.uniform(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 t1 = s1->x; + Vector t2 = s2->x; + Vector t12 = t1 - t2; Vector t = (t1 + t2) / 2; - double θ = atan2(t12[1], t12[0]) + rng.variate(0.0, ε) / t12.norm(); + double θ = atan2(t12(1), t12(0)) + rng.variate(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 g(t - m * t, m); + Vector t3 = t - m * t; + + if (t3(0) != t3(0)) { + std::cout << t3 << "\n" << t << "\n" << m << "\n" << t12 << "\n" ; + getchar(); + } + + Euclidean g(t3, m); return new PairFlip, 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); -- cgit v1.2.3-54-g00ecf