Exemple #1
0
        /// <summary>
        /// This needs to be called after the model is set.
        /// </summary>
        internal static Mobius RandomMobius(Tiler.Settings settings, Random rand)
        {
            Geometry g = settings.Geometry;

            // Pick a random point to move to origin.
            // Could be cool to make the geometry arbitrary here (i.e. a spherical transformation applied to a euclidean tiling looks sweet).
            Mobius  m = new Mobius();
            Complex c = new Complex(rand.NextDouble() / 2, rand.NextDouble() / 2);
            double  a = rand.NextDouble() * Math.PI;

            if (g == Geometry.Euclidean)
            {
                if (settings.EuclideanModel == EuclideanModel.Isometric ||
                    settings.EuclideanModel == EuclideanModel.Loxodromic)
                {
                    // I don't really like how the rotations look in the plane.
                    // For Loxodromic, things won't line up if we allow this.
                    a = 0;
                }
                else if (settings.EuclideanModel == EuclideanModel.Conformal)
                {
                    g = Geometry.Spherical;
                    c = new Complex(rand.NextDouble() * 4, rand.NextDouble() * 4);
                }
            }

            m.Isometry(g, a, c);
            return(m);
        }
Exemple #2
0
        static public Mobius RotAboutPoint(Geometry g, Vector3D p, double rot)
        {
            Mobius m1 = new Mobius(), m2 = new Mobius();

            m1.Isometry(g, 0, p);
            m2.Isometry(g, rot, new Complex());
            return(m1 * m2 * m1.Inverse());
        }