Пример #1
0
        private static List <Vector3D[]> BasePointsTiling()
        {
            TilingConfig config = new TilingConfig(3, 7, maxTiles: 100);
            Tiling       tiling = new Tiling();

            tiling.Generate(config);

            HashSet <H3.Cell.Edge> finished = new HashSet <H3.Cell.Edge>(new H3.Cell.EdgeEqualityComparer());

            int numPerSeg = 25;
            List <Vector3D[]> basePoints = new List <Vector3D[]>();

            foreach (Tile t in tiling.Tiles)
            {
                foreach (Segment s in t.Boundary.Segments)
                {
                    H3.Cell.Edge e = new H3.Cell.Edge(s.P1, s.P2);
                    if (finished.Contains(e))
                    {
                        continue;
                    }
                    finished.Add(e);

                    Vector3D[] points = s.Subdivide(numPerSeg).Select(p =>
                    {
                        p = new Vector3D(p.X, 0, p.Y);
                        return(H3Models.BallToUHS(p));
                    }).ToArray();
                    basePoints.Add(points);
                }
            }

            return(basePoints);
        }
Пример #2
0
        public static void Experiment()
        {
            TilingConfig config = new TilingConfig(4, 3);
            Tiling       tiling = new Tiling();

            tiling.Generate(config);

            HashSet <H3.Cell.Edge> completed = new HashSet <H3.Cell.Edge>(new H3.Cell.EdgeEqualityComparer());

            string fileName = "hopf.pov";

            using (StreamWriter sw = File.CreateText(fileName))
            {
                Tile[] tiles = tiling.Tiles.ToArray();
                //foreach( Tile t in tiling.Tiles )
                foreach (Tile t in new Tile[] { tiles[0] })
                {
                    foreach (Segment seg in t.Boundary.Segments)
                    {
                        H3.Cell.Edge e = new H3.Cell.Edge(seg.P1, seg.P2);
                        if (completed.Contains(e))
                        {
                            continue;
                        }

                        HopfLink(sw,
                                 Sterographic.PlaneToSphereSafe(e.Start),
                                 Sterographic.PlaneToSphereSafe(e.End), anti: false);
                        completed.Add(e);
                    }
                }
            }
        }