internal static void TileImages() { List <HoneycombDef> images = HoneycombPaper.GetImageSet().ToList(); string[] inputImages = images.Select(i => i.FormatFilename()).ToArray(); inputImages = new string[] { "46.png", "4_10.png", "4_20.png", "4i.png", "64.png", "10_4.png", "20_4.png", "i4.png", }; ImageGrid imageGrid = new ImageGrid(); imageGrid.Generate(new ImageGrid.Settings() { //Directory = @"C:\Users\hrn\Documents\roice\2D Tilings\2D Tilings 9-7-15\2D Tilings\bin\Release", Directory = @"C:\Users\hrn\Documents\roice\G4G\Figures", //Directory = @"./", InputImages = inputImages }); }
/* * Known problems: * Orthoscheme code may not be working out of the box for: * - spherical honeycombs * - honeycomb with hyperideal cells */ static void Main(string[] args) { try { List <string> filenames = new List <string>(); if (args.Length > 0 && File.Exists(args[0])) { filenames.Add(args[0]); } else { filenames = Directory.EnumerateFiles(".", "*.xml", SearchOption.TopDirectoryOnly).ToList(); } // Go through any settings files. foreach (string filename in filenames) { Settings settings = LoadSettings(filename); if (settings == null) { continue; } // Boundary images. if (settings.UhsBoundary != null) { Log("\nGenerating UHS boundary image for the following honeycomb:\n" + settings.HoneycombString); Log("\nSettings...\n" + settings.UhsBoundary.DisplayString); HoneycombPaper.OneImage(settings); } // POV-Ray definition files. if (settings.PovRay != null) { Log("\nGenerating POV-Ray definition file for the following honeycomb:\n" + settings.HoneycombString); Log("\nSettings...\n" + settings.PovRay.DisplayString); if (settings.Angles.Length == 3) { HoneycombGen.OneHoneycombOrthoscheme(settings); } else if (settings.Angles.Length == 6) { HoneycombGen.OneHoneycombGoursat(settings); } } } } catch (System.Exception ex) { Log(ex.Message + "\n" + ex.StackTrace); } }
public static void Create(HoneycombDef def, string filename) { int p = def.P; int q = def.Q; int r = def.R; double scale = 5.0; Vector3D cen = HoneycombPaper.InteriorPointBall; Sphere[] simplex = SimplexCalcs.Mirrors(p, q, r, moveToBall: false); // Apply transformations. simplex = simplex.Select(s => { Sphere.ScaleSphere(s, scale); return(H3Models.UHSToBall(s)); }).ToArray(); for (int i = 0; i < 4; i++) { if (simplex[i].IsPointInside(cen)) { simplex[i].Invert = true; } } Sphere[] simplexForColorScale = SimplexCalcs.Mirrors(p, q, r, moveToBall: true); CoxeterImages.Settings temp = HoneycombPaper.AutoCalcScale(def, simplexForColorScale); int maxDepth = (int)temp.ColorScaling; bool ball = true; bool dual = false; H3.Cell[] simplicesFinal = HoneycombPaper.GenCell(simplex, null, cen, ball, dual); simplicesFinal = simplicesFinal.Where(s => s.Depths[0] < 1).ToArray(); //simplicesFinal = simplicesFinal.Where( s => s.) // Output the facets. using (StreamWriter sw = File.CreateText(filename)) // We need to reuse this StreamWriter (vs. calling AppendSimplex) for performance. { sw.WriteLine("#include \"hyper_ball.pov\""); int[] include = new int[] { 0 }; foreach (H3.Cell cell in simplicesFinal) { Sphere[] facets = cell.Facets.Select(f => f.Sphere).ToArray(); int depth = cell.Depths[0] + 1; Color c = Coloring.ColorAlongHexagon(maxDepth, depth); PovRay.AddSimplex(sw, facets, cell.Center, include, filename, Coloring.ToVec(c)); } } }