Exemple #1
0
        //Take a LatticeGeometry and return the polygons that spatially make it up
        //This is useful for display purposes, each lattice element then corresponds to a polygon element
        public static void calculate_polygon_tiling(List <List <Vector2D> > polygon_list, Lattice_Geometry lattice_geometry)
        {
            Lattice_Graph lattice_graph = lattice_geometry.Lattice;

            List <List <int> > graph    = lattice_graph.GetVertices();
            List <Vector2D>    geometry = lattice_geometry.GeometryPoints;

            int p = lattice_graph.P;
            int q = lattice_graph.Q;

            double base_length = lattice_geometry.LengthScale * EuclideanTransversalLength(p, q);

            if (lattice_graph.GetCurvatureSign() == -1)
            {
                base_length = HyperbolicToPpoincare(HyperbolicTransversalLength(p, q));
            }

            Vector2D base_vector = new Gyrovector2D(base_length, 0.0);

            double dt = 2 * Math.PI / p;

            base_vector = base_vector.Rotate(Math.PI / p);

            if (lattice_graph.Size == 1)
            {
                List <Vector2D> poly = new List <Vector2D>();
                for (int i = 0; i < p; i++)
                {
                    poly.Add(base_vector.Rotate(i * dt));
                }
                polygon_list.Add(poly);

                return;
            }

            for (int i = 0; i < lattice_graph.Size; i++)
            {
                List <Vector2D> poly = new List <Vector2D>(p);

                Vector2D current  = geometry[i];
                Vector2D neighbor = geometry[graph[i][0]];

                double guide_direction = ((-current) + neighbor).Phase();

                Vector2D offset = base_vector.Rotate(guide_direction);

                for (int k = 0; k < p; k++)
                {
                    poly.Add(current + offset.Rotate(k * dt));
                }

                polygon_list.Add(poly);
            }
        }
Exemple #2
0
        public Lattice_Geometry(int p, int q, int r, double spacing)
        {
            Lattice = new Lattice_Graph(p, q, r, false);

            if (Lattice.GetCurvatureSign() == 0)
            {
                GuideVector = new Euclvector2D(spacing, 0.0);
            }
            else if (Lattice.GetCurvatureSign() == -1)
            {
                GuideVector = new Gyrovector2D(spacing, 0.0);
            }

            valid          = new List <bool>(4000);
            GeometryPoints = new List <Vector2D>(4000);
            LengthScale    = spacing;

            Compose();
        }
Exemple #3
0
        public Lattice_Geometry(Lattice_Graph lat, double spacing)
        {
            Lattice = lat;

            if (lat.GetCurvatureSign() == 0)
            {
                GuideVector = new Euclvector2D(spacing, 0.0);
            }
            else if (lat.GetCurvatureSign() == -1)
            {
                GuideVector = new Gyrovector2D(spacing, 0.0);
            }

            valid          = new List <bool>(4000);
            GeometryPoints = new List <Vector2D>(4000);
            LengthScale    = spacing;

            Compose();
        }
Exemple #4
0
        //Take a polygon list and generate a list of edges, useful for display purposes
        public static void graph_to_edge_list(Lattice_Graph lattice, List <Edge <int> > edge_list)
        {
            List <List <int> > graph = lattice.GetVertices();

            for (int i = 0; i < graph.Count; i++)
            {
                List <int> vertex = graph[i];

                for (int j = 0; j < vertex.Count; j++)
                {
                    Edge <int> edge = new Edge <int>(i, vertex[j]);

                    if (!edge_list.Contains(edge))
                    {
                        edge_list.Add(edge);
                    }
                }
            }
        }