Example #1
0
        // Rotates a dodec about a vertex or edge to get a dual dodec.
        private static Dodec GetDual(Dodec dodec, Vector3D rotationPoint)
        {
            //double rot = System.Math.PI / 2;	// Edge-centered
            double rot = 4 * (-Math.Atan((2 + Math.Sqrt(5) - 2 * Math.Sqrt(3 + Math.Sqrt(5))) / Math.Sqrt(3)));                                 // Vertex-centered

            Mobius m = new Mobius();

            if (Infinity.IsInfinite(rotationPoint))
            {
                m.Elliptic(Geometry.Spherical, new Vector3D(), -rot);
            }
            else
            {
                m.Elliptic(Geometry.Spherical, rotationPoint, rot);
            }

            Dodec dual = new Dodec();

            foreach (Vector3D v in dodec.Verts)
            {
                Vector3D rotated = m.ApplyInfiniteSafe(v);
                dual.Verts.Add(rotated);
            }

            foreach (Vector3D v in dodec.Midpoints)
            {
                Vector3D rotated = m.ApplyInfiniteSafe(v);
                dual.Midpoints.Add(rotated);
            }

            return(dual);
        }
Example #2
0
        private static Mobius RotMobius(Vector3D vertex0)
        {
            // A third rotation about the vertex.
            Mobius m = new Mobius();

            m.Elliptic(Geometry.Hyperbolic, vertex0, 2 * Math.PI / 3);
            return(m);
        }
Example #3
0
        public Mobius MobiusForTwist(Geometry g, SingleTwist twist, double rotation, bool earthquake, bool earthquakeData = false)
        {
            Mobius mobius = new Mobius();

            if (earthquake)
            {
                int seg = earthquakeData ?
                          (twist.SliceMaskEarthquake * 2 + 3) % 6 :
                          (twist.SliceMask * 2 + 3) % 6;
                Vector3D p1 = this.Pants.Hexagon.Segments[seg].P2;
                Vector3D p2 = Pants.Hexagon.Segments[seg].P1;
                if (Pants.Isometry.Reflected)
                {
                    R3.Core.Utils.SwapPoints(ref p1, ref p2);
                }
                System.Diagnostics.Debug.Assert(!Reverse);
                mobius.Geodesic(Geometry.Hyperbolic, p1, p2, rotation);
            }
            else
            {
                mobius.Elliptic(g, Center, Reverse ? rotation * -1 : rotation);
            }
            return(mobius);
        }