public static H3.Cell[] CalcCells2( Sphere[] mirrors, H3.Cell[] cells, Settings settings ) { HashSet<Vector3D> completedCellIds = new HashSet<Vector3D>( cells.Select( c => c.ID ).ToArray() ); List<H3.Cell> completedCells = new List<H3.Cell>( cells ); ReflectCellsRecursive2( mirrors, cells, settings, completedCells, completedCellIds ); return completedCells.ToArray(); }
protected override bool TryHashFinal(Span <byte> destination, out int bytesWritten) { if (destination.Length < 16) { bytesWritten = 0; return(false); } var len = (uint)Length; // pipelining friendly algorithm H1 ^= len; H2 ^= len; H3 ^= len; H4 ^= len; H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; H1 = H1.FMix(); H2 = H2.FMix(); H3 = H3.FMix(); H4 = H4.FMix(); H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; var uintDestination = MemoryMarshal.Cast <byte, uint>(destination); uintDestination[0] = H1; uintDestination[1] = H2; uintDestination[2] = H3; uintDestination[3] = H4; bytesWritten = 16; return(true); }
private void Body(byte[] data, int start, int length) { int remainder = length & 15; int alignedLength = start + (length - remainder); for (int i = start; i < alignedLength; i += 16) { uint k1 = data.ToUInt32(i), k2 = data.ToUInt32(i + 4), k3 = data.ToUInt32(i + 8), k4 = data.ToUInt32(i + 12); H1 ^= (k1 * C1).RotateLeft(15) * C2; H1 = (H1.RotateLeft(19) + H2) * 5 + 0x561ccd1b; H2 ^= (k2 * C2).RotateLeft(16) * C3; H2 = (H2.RotateLeft(17) + H3) * 5 + 0x0bcaa747; H3 ^= (k3 * C3).RotateLeft(17) * C4; H3 = (H3.RotateLeft(15) + H4) * 5 + 0x96cd1c35; H4 ^= (k4 * C4).RotateLeft(18) * C1; H4 = (H4.RotateLeft(13) + H1) * 5 + 0x32ac3b17; } if (remainder > 0) { Tail(data, alignedLength, remainder); } }
public void Reset(Control host) { H1.Reset(host); H2.Reset(host); H3.Reset(host); H4.Reset(host); H5.Reset(host); H6.Reset(host); BlockQuote.Reset(host); P.Reset(host); FigCaption.Reset(host); Pre.Reset(host); Dt.Reset(host); Dd.Reset(host); Li.Reset(host); A.Reset(host); Span.Reset(host); Label.Reset(host); Q.Reset(host); Cite.Reset(host); I.Reset(host); Em.Reset(host); Mark.Reset(host); Time.Reset(host); Code.Reset(host); Strong.Reset(host); }
public void Start() { cli1_1.text = ""; cli2_1.text = ""; cli1_2.text = ""; cli2_2.text = ""; cli1_3.text = ""; cli2_3.text = ""; cli1_4.text = ""; cli2_4.text = ""; cli1_5.text = ""; cli2_5.text = ""; F1.SetActive(false); H1.SetActive(false); H11.SetActive(false); F2.SetActive(false); H2.SetActive(false); H22.SetActive(false); F3.SetActive(false); H3.SetActive(false); H33.SetActive(false); F4.SetActive(false); H4.SetActive(false); H44.SetActive(false); F5.SetActive(false); H5.SetActive(false); H55.SetActive(false); }
protected override byte[] HashFinal() { uint len = (uint)Length; H1 ^= len; H2 ^= len; H3 ^= len; H4 ^= len; H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; H1 = H1.FMix(); H2 = H2.FMix(); H3 = H3.FMix(); H4 = H4.FMix(); H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; var result = new byte[16]; Array.Copy(BitConverter.GetBytes(H1), 0, result, 0, 4); Array.Copy(BitConverter.GetBytes(H2), 0, result, 4, 4); Array.Copy(BitConverter.GetBytes(H3), 0, result, 8, 4); Array.Copy(BitConverter.GetBytes(H4), 0, result, 12, 4); return(result); }
protected override byte[] HashFinal() { uint len = (uint)Length; // pipelining friendly algorithm H1 ^= len; H2 ^= len; H3 ^= len; H4 ^= len; H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; H1 = H1.FMix(); H2 = H2.FMix(); H3 = H3.FMix(); H4 = H4.FMix(); H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; var result = new byte[16]; unsafe { fixed(byte *h = result) { var r = (uint *)h; r[0] = H1; r[1] = H2; r[2] = H3; r[3] = H4; } } return(result); }
private void H6_Tick(object sender, EventArgs e) { WriteText("^1-- ^5N^7o ^5H^7ost ^5M^7od ^5M^7enu ^5B^7y ^5M^7rNiato ^1--\n\n^5Steady Aim\nUAV\nRed Boxes\n^2-->^5Invisible Gun\nLaser\nSilent Gun\nNo Recoil"); if (Key_IsDown.DetectKey(Key_IsDown.Key.Cross)) { if (InvisibleGun == false) { byte[] godmodebyte = new byte[] { 0x01 }; PS3.SetMemory(0x21B8C7, godmodebyte); InvisibleGun = true; } else if (InvisibleGun == true) { byte[] godmodebyte = new byte[] { 0x00 }; PS3.SetMemory(0x21B8C7, godmodebyte); InvisibleGun = false; } } if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_DOWN)) { H6.Stop(); H7.Start(); } if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_UP)) { H6.Stop(); H3.Start(); } if (Key_IsDown.DetectKey(Key_IsDown.Key.R3)) { H6.Stop(); HostMainMenu.Start(); } }
public static void EdgesToStl( H3.Cell.Edge[] edges ) { Shapeways mesh = new Shapeways(); int divisions = 10; foreach( H3.Cell.Edge edge in edges ) { Segment seg = Segment.Line( Sterographic.R3toS3( edge.Start ), Sterographic.R3toS3( edge.End ) ); Vector3D[] points = seg.Subdivide( divisions ); ProjectAndAddS3Points( mesh, points ); } for( int i = 0; i < mesh.Mesh.Triangles.Count; i++ ) { mesh.Mesh.Triangles[i] = new Mesh.Triangle( SphericalModels.GnomonicToStereo( mesh.Mesh.Triangles[i].a ), SphericalModels.GnomonicToStereo( mesh.Mesh.Triangles[i].b ), SphericalModels.GnomonicToStereo( mesh.Mesh.Triangles[i].c ) ); } STL.SaveMeshToSTL( mesh.Mesh, @"output.stl" ); }
/// <summary> /// Add a finite (truncated) banana to our mesh. Passed in edge should be in Ball model. /// </summary> public static void AddBanana( Shapeways mesh, Vector3D e1, Vector3D e2, H3.Settings settings ) { Vector3D e1UHS = H3Models.BallToUHS( e1 ); Vector3D e2UHS = H3Models.BallToUHS( e2 ); // Endpoints of the goedesic on the z=0 plane. Vector3D z1, z2; H3Models.UHS.GeodesicIdealEndpoints( e1UHS, e2UHS, out z1, out z2 ); // XXX - Do we want to do a better job worrying about rotation here? // (multiply by complex number with certain imaginary part as well) //Vector3D z3 = ( z1 + z2 ) / 2; //if( Infinity.IsInfinite( z3 ) ) // z3 = new Vector3D( 1, 0 ); Vector3D z3 = new Vector3D( Math.E, Math.PI ); // This should vary the rotations a bunch. // Find the Mobius we need. // We'll do this in two steps. // (1) Find a mobius taking z1,z2 to origin,inf // (2) Deal with scaling e1 to a height of 1. Mobius m1 = new Mobius( z1, z3, z2 ); Vector3D e1UHS_transformed = m1.ApplyToQuaternion( e1UHS ); double scale = 1.0 / e1UHS_transformed.Z; Mobius m2 = Mobius.Scale( scale ); Mobius m = m2 * m1; // Compose them (multiply in reverse order). Vector3D e2UHS_transformed = m.ApplyToQuaternion( e2UHS ); // Make our truncated cone. // For regular tilings, we really would only need to do this once for a given LOD. List<Vector3D> points = new List<Vector3D>(); double logHeight = Math.Log( e2UHS_transformed.Z ); if( logHeight < 0 ) throw new System.Exception( "impl issue" ); int div1, div2; H3Models.Ball.LOD_Finite( e1, e2, out div1, out div2, settings ); double increment = logHeight / div1; for( int i=0; i<=div1; i++ ) { double h = increment * i; // This is to keep different bananas from sharing exactly coincident vertices. double tinyOffset = 0.001; if( i == 0 ) h -= tinyOffset; if( i == div1 ) h += tinyOffset; Vector3D point = new Vector3D( 0, 0, Math.Exp( h ) ); points.Add( point ); } Shapeways tempMesh = new Shapeways(); tempMesh.Div = div2; tempMesh.AddCurve( points.ToArray(), v => H3Models.UHS.SizeFunc( v, settings.AngularThickness ) ); // Unwind the transforms. TakePointsBack( tempMesh.Mesh, m.Inverse(), settings ); mesh.Mesh.Triangles.AddRange( tempMesh.Mesh.Triangles ); }
/// <summary> /// An alternative version for facets that require extra clipping. /// </summary> public static void AppendFacets( H3.Cell[] cells, string fileName ) { HashSet<Sphere> completed = new HashSet<Sphere>(); using( StreamWriter sw = File.AppendText( fileName ) ) { foreach( H3.Cell cell in cells ) sw.WriteLine( H3Facet( cell, completed ) ); } }
public void Merge(params DocumentStyle[] styles) { if (styles != null) { foreach (var style in styles) { Section.Merge(style.Section); Article.Merge(style.Article); Header.Merge(style.Header); Footer.Merge(style.Footer); Main.Merge(style.Main); Figure.Merge(style.Figure); Details.Merge(style.Details); Summary.Merge(style.Summary); Div.Merge(style.Div); Ul.Merge(style.Ul); Ol.Merge(style.Ol); Dl.Merge(style.Dl); Td.Merge(style.Td); Table.Merge(style.Table); Img.Merge(style.Img); YouTube.Merge(style.YouTube); Channel9.Merge(style.Channel9); H1.Merge(style.H1); H2.Merge(style.H2); H3.Merge(style.H3); H4.Merge(style.H4); H5.Merge(style.H5); H6.Merge(style.H6); BlockQuote.Merge(style.BlockQuote); P.Merge(style.P); FigCaption.Merge(style.FigCaption); Pre.Merge(style.Pre); Dt.Merge(style.Dt); Dd.Merge(style.Dd); Li.Merge(style.Li); A.Merge(style.A); Span.Merge(style.Span); Label.Merge(style.Label); Q.Merge(style.Q); Cite.Merge(style.Cite); I.Merge(style.I); Em.Merge(style.Em); Mark.Merge(style.Mark); Time.Merge(style.Time); Code.Merge(style.Code); Strong.Merge(style.Strong); } } }
/// <summary> /// Outputs edges to an stl file. /// </summary> public void Output() { System.Func <Vector3D, Vector3D> p2s = v => Spherical2D.PlaneToSphere(v); System.Func <Vector3D, Vector3D> transform = v => H3Models.Ball.ApplyMobius(Mobius.Scale(3), v); double min = double.MaxValue; Cell cell = m_cells.First(); foreach (Vector3D v1 in cell.Tiles[0].Boundary.Vertices) { foreach (Vector3D v2 in cell.Tiles[1].Boundary.Vertices) { min = Math.Min(min, p2s(v1).Dist(p2s(v2))); } } // XXX - code below so ugly to read! Dictionary <TileVertex, TileVertex> vMap = new Dictionary <TileVertex, TileVertex>(); for (int tile_i = 0; tile_i < cell.Tiles.Length; tile_i++) { for (int tile_j = tile_i + 1; tile_j < cell.Tiles.Length; tile_j++) { for (int vertex_i = 0; vertex_i < cell.Tiles[tile_i].Boundary.Vertices.Length; vertex_i++) { for (int vertex_j = 0; vertex_j < cell.Tiles[tile_j].Boundary.Vertices.Length; vertex_j++) { Vector3D v1 = cell.Tiles[tile_i].Boundary.Vertices[vertex_i]; Vector3D v2 = cell.Tiles[tile_j].Boundary.Vertices[vertex_j]; if (Tolerance.Equal(p2s(v1).Dist(p2s(v2)), min)) { vMap[new TileVertex(tile_i, vertex_i)] = new TileVertex(tile_j, vertex_j); } } } } } HashSet <H3.Cell.Edge> edges = new HashSet <H3.Cell.Edge>(new H3.Cell.EdgeEqualityComparer()); foreach (Cell c in m_cells) { foreach (KeyValuePair <TileVertex, TileVertex> kvp in vMap) { Vector3D v1 = transform(p2s(c.Tiles[kvp.Key.Item1].Boundary.Vertices[kvp.Key.Item2])); Vector3D v2 = transform(p2s(c.Tiles[kvp.Value.Item1].Boundary.Vertices[kvp.Value.Item2])); edges.Add(new H3.Cell.Edge(v1, v2)); } } //H3.m_settings.ThinEdges = true; H3.SaveToFile("ultrainf", edges.ToArray(), finite: false); }
/// <summary> /// This generates a honeycomb by reflecting in all facets of a cell. /// </summary> public static void OneHoneycombOldCode() { H3.GenHoneycomb(EHoneycomb.H435); //H3.GenHoneycomb( EHoneycomb.H337 ); //H3.GenHoneycomb( EHoneycomb.H436 ); //H3.GenHoneycomb( EHoneycomb.H536 ); //H3.GenHoneycomb( EHoneycomb.H444 ); //H3.GenHoneycomb( EHoneycomb.H363 ); //H3.GenHoneycomb( EHoneycomb.H636 ); //H3.GenHoneycomb( EHoneycomb.H337 ); }
private void Body(byte[] data, int start, int length) { if (length == 0) { return; } int remainder = length & 15; int blocks = length / 16; unsafe { fixed(byte *d = &data[start]) { // grab a reference to blocks uint *b = (uint *)d; while (blocks-- > 0) { // K1 - consume first integer H1 ^= (*b++ *C1).RotateLeft(15) * C2; H1 = (H1.RotateLeft(19) + H2) * 5 + 0x561ccd1b; // K2 - consume second integer H2 ^= (*b++ *C2).RotateLeft(16) * C3; H2 = (H2.RotateLeft(17) + H3) * 5 + 0x0bcaa747; // K3 - consume third integer H3 ^= (*b++ *C3).RotateLeft(17) * C4; H3 = (H3.RotateLeft(15) + H4) * 5 + 0x96cd1c35; // K4 - consume fourth integer H4 ^= (*b++ *C4).RotateLeft(18) * C1; H4 = (H4.RotateLeft(13) + H1) * 5 + 0x32ac3b17; } if (remainder > 0) { Tail(d + (length - remainder), remainder); } } } }
private void Body(ReadOnlySpan <byte> source) { if (source.Length == 0) { return; } var remainder = source.Length & 15; var blocks = 4 * (source.Length / 16); if (blocks > 0) { var uintSource = MemoryMarshal.Cast <byte, uint>(source); var block = 0; while (block < blocks) { var k1 = uintSource[block++]; var k2 = uintSource[block++]; var k3 = uintSource[block++]; var k4 = uintSource[block++]; H1 ^= (k1 * C1).RotateLeft(15) * C2; H1 = ((H1.RotateLeft(19) + H2) * 5) + 0x561ccd1b; H2 ^= (k2 * C2).RotateLeft(16) * C3; H2 = ((H2.RotateLeft(17) + H3) * 5) + 0x0bcaa747; H3 ^= (k3 * C3).RotateLeft(17) * C4; H3 = ((H3.RotateLeft(15) + H4) * 5) + 0x96cd1c35; H4 ^= (k4 * C4).RotateLeft(18) * C1; H4 = ((H4.RotateLeft(13) + H1) * 5) + 0x32ac3b17; } } if (remainder > 0) { Tail(source.Slice(4 * blocks)); } }
public override unsafe Memory <byte> FinalizeHash() { uint len = (uint)Length; // pipelining friendly algorithm H1 ^= len; H2 ^= len; H3 ^= len; H4 ^= len; H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; H1 = H1.FMix(); H2 = H2.FMix(); H3 = H3.FMix(); H4 = H4.FMix(); H1 += (H2 + H3 + H4); H2 += H1; H3 += H1; H4 += H1; var result = new Memory <byte>(new byte[16]); using var hMemory = result.Pin(); var r = (uint *)hMemory.Pointer; r[0] = H1; r[1] = H2; r[2] = H3; r[3] = H4; return(result); }
public void ClearMenuAttempts() { F1.SetActive(false); H1.SetActive(false); H11.SetActive(false); F2.SetActive(false); H2.SetActive(false); H22.SetActive(false); F3.SetActive(false); H3.SetActive(false); H33.SetActive(false); F4.SetActive(false); H4.SetActive(false); H44.SetActive(false); F5.SetActive(false); H5.SetActive(false); H55.SetActive(false); cli1_1.SetText(""); cli2_1.SetText(""); cli1_2.SetText(""); cli2_2.SetText(""); cli1_3.SetText(""); cli2_3.SetText(""); cli1_4.SetText(""); cli2_4.SetText(""); cli1_5.SetText(""); cli2_5.SetText(""); }
/// <summary> /// Creates block element based on paragraph type /// </summary> /// <param name="type"></param> /// <returns></returns> private static HTMLItem CreateBlock(ParagraphConvTargetEnumV2 type) { HTMLItem paragraph; switch (type) { case ParagraphConvTargetEnumV2.H1: paragraph = new H1(HTMLElementType.XHTML11); break; case ParagraphConvTargetEnumV2.H2: paragraph = new H2(HTMLElementType.XHTML11); break; case ParagraphConvTargetEnumV2.H3: paragraph = new H3(HTMLElementType.XHTML11); break; case ParagraphConvTargetEnumV2.H4: paragraph = new H4(HTMLElementType.XHTML11); break; case ParagraphConvTargetEnumV2.H5: paragraph = new H5(HTMLElementType.XHTML11); break; case ParagraphConvTargetEnumV2.H6: paragraph = new H6(HTMLElementType.XHTML11); break; default: // Paragraph or anything else paragraph = new Paragraph(HTMLElementType.XHTML11); break; } return(paragraph); }
/// <summary> /// Wendy's 77 /// </summary> public static void Wendy( Simplex simplex, H3.Cell.Edge[] edges ) { H3.Cell startingCell = null; Vector3D start = startingCell.Verts.First(); Func<Vector3D, Vector3D> findAntipode = input => { Vector3D antipode = new Vector3D(); double max = double.MinValue; foreach( Vector3D v in startingCell.Verts ) { double d = H3Models.Ball.HDist( v, input ); if( d > max ) { max = d; antipode = v; } } return antipode; }; H3.Cell.Edge[] diagonals = new H3.Cell.Edge[] { new H3.Cell.Edge( start, findAntipode( start ) ) }; diagonals = Recurse.CalcEdges( simplex.Facets, diagonals, new Recurse.Settings() { Threshold = 0.9983 } ); // diagonals includes too much at this point (it includes all icosahedra diagonals, but we only want one diagonal from each cell). // We need to begin at 4 start points, and branch out from each to find the ones we want. var vertsToDiagonals = FindConnectedEdges( diagonals ); var connectedEdges = FindConnectedEdges( edges ); // Get all edges (not diagonals) connected to start. List<H3.Cell.Edge> connectedToStart = connectedEdges[start]; Vector3D startOpp = connectedToStart[0].Opp( start ); List<H3.Cell.Edge> connectedToStartOpp = connectedEdges[startOpp]; // We need to pick 4 of these edges, arranged in a tetrahedron for our starting points. List<Vector3D> startingPoints = new List<Vector3D>(); List<double> distances = new List<double>(); // View1 //startingPoints.Add( start ); //foreach( Vector3D v in connectedToStartOpp.Select( e => e.Opp( startOpp ) ) ) // distances.Add( H3Models.Ball.HDist( startingPoints.First(), v ) ); //startingPoints.Add( connectedToStartOpp[10].Opp( startOpp ) ); //startingPoints.Add( connectedToStartOpp[13].Opp( startOpp ) ); //startingPoints.Add( connectedToStartOpp[14].Opp( startOpp ) ); // View2 startingPoints.Add( startOpp ); foreach( Vector3D v in connectedToStart.Select( e => e.Opp( start ) ) ) distances.Add( H3Models.Ball.HDist( startingPoints.First(), v ) ); startingPoints.Add( connectedToStart[10].Opp( start ) ); startingPoints.Add( connectedToStart[13].Opp( start ) ); startingPoints.Add( connectedToStart[14].Opp( start ) ); distances.Clear(); distances.Add( H3Models.Ball.HDist( startingPoints[1], startingPoints[2] ) ); distances.Add( H3Models.Ball.HDist( startingPoints[1], startingPoints[3] ) ); distances.Add( H3Models.Ball.HDist( startingPoints[2], startingPoints[3] ) ); distances.Add( H3Models.Ball.HDist( startingPoints[0], startingPoints[1] ) ); distances.Add( H3Models.Ball.HDist( startingPoints[0], startingPoints[2] ) ); distances.Add( H3Models.Ball.HDist( startingPoints[0], startingPoints[3] ) ); double dist = 3.097167; Func<Vector3D[], H3.Cell.Edge[]> RemoveVerts = starting => { List<H3.Cell.Edge> keepers = new List<H3.Cell.Edge>(); HashSet<Vector3D> removedVerts = new HashSet<Vector3D>(); Recurse.BranchAlongVerts( starting.ToArray(), vertsToDiagonals, removedVerts ); foreach( H3.Cell.Edge e in edges ) { if( removedVerts.Contains( e.Start ) || removedVerts.Contains( e.End ) ) continue; keepers.Add( e ); } return keepers.ToArray(); }; edges = RemoveVerts( startingPoints.ToArray() ); bool done = false; while( !done ) { done = true; var newConnectedEdges = FindConnectedEdges( edges ); foreach( Vector3D v in newConnectedEdges.Keys ) { List<H3.Cell.Edge> oldEdgeList = connectedEdges[v]; List<H3.Cell.Edge> newEdgeList = newConnectedEdges[v]; // Only work edges that were full originally. if( oldEdgeList.Count != 20 ) continue; // We need at least two to find the rest. int newCount = newEdgeList.Count; if( newCount > 16 && newCount < 19 ) { List<H3.Cell.Edge> removed = oldEdgeList.Except( newEdgeList, new H3.Cell.EdgeEqualityComparer() ).ToList(); H3.Cell.Edge[] toTrim = newEdgeList.FindAll( e => { foreach( H3.Cell.Edge alreadyRemoved in removed ) { double d = H3Models.Ball.HDist( alreadyRemoved.Opp( v ), e.Opp( v ) ); if( !Tolerance.Equal( dist, d, 0.00001 ) ) return false; } return true; } ).ToArray(); edges = RemoveVerts( toTrim.Select( e => e.Opp( v ) ).ToArray() ); done = false; } if( newCount == 20 ) done = false; } } }
public static H3.Cell.Edge[] OneHoneycombOrthoscheme(HoneycombDef def, int[] active, int baseHue, Settings settings = null) { // Setup parameters. int numEdges = 250000; if (settings != null) { active = settings.PovRay.Active; def = new HoneycombDef(settings.P, settings.Q, settings.R); numEdges = settings.PovRay.NumEdges; } CalcThickness(active); if (settings != null) { H3.m_settings.AngularThickness = settings.PovRay.EdgeWidth; // ZZZ - should really stop using that settings class. } string baseName = BaseName(def); string mirrorsString = ActiveMirrorsString(active); string suffix = "-" + mirrorsString; string fileName = baseName + suffix; if (ViewPath != null) { fileName += string.Format("_{0:D4}", ViewPath.Step); } if (File.Exists(fileName + ".pov")) { File.Delete(fileName + ".pov"); //Console.WriteLine( string.Format( "Skipping {0}", fileName ) ); //return; } Program.Log(string.Format("Building {0}", fileName)); // The wiki mirrors are labeled in the reverse of ours. Func <int, int> mapMirror = i => 3 - i; active = active.Select(i => mapMirror(i)).OrderBy(i => i).ToArray(); Simplex simplex = new Simplex(); simplex.Facets = SimplexCalcs.Mirrors(def.P, def.Q, def.R); simplex.Verts = SimplexCalcs.VertsBall(def.P, def.Q, def.R); Vector3D startingPoint = IterateToStartingPoint(def, active, simplex); if (startingPoint.DNE) { return(null); } List <H3.Cell.Edge> startingEdges = new List <H3.Cell.Edge>(); foreach (int a in active) { Vector3D reflected = simplex.ReflectInFacet(startingPoint, a); startingEdges.Add(new H3.Cell.Edge(startingPoint, reflected)); //startingEdges.Add( new H3.Cell.Edge( simplex.Verts[0], simplex.Verts[3] ) ); // Used for Borromean Rings complement image. } if (false) { Vector3D[] kv = simplex.Verts.Select(v => HyperbolicModels.PoincareToKlein(v)).ToArray(); kv[3] = SimplexCalcs.VertexPointKlein(def.P, def.Q, def.R); Vector3D t = (kv[3] - kv[0]) * 0.5; Sphere gSphere = H3Models.Ball.OrthogonalSphereInterior(HyperbolicModels.KleinToPoincare(t)); gSphere = H3Models.BallToKlein(gSphere); Vector3D t2 = Euclidean3D.IntersectionPlaneLine(gSphere.Normal, gSphere.Offset, kv[3] - kv[2], kv[2]); //t2 = kv[2] + ( kv[3] - kv[2]) * 0.5; t = HyperbolicModels.KleinToPoincare(t); t2 = HyperbolicModels.KleinToPoincare(t2); startingEdges.Add(new H3.Cell.Edge(t, t2)); startingEdges.Add(new H3.Cell.Edge(t, simplex.ReflectInFacet(t, 3))); } // If we are doing a view path, transform our geometry. if (ViewPath != null) { //Vector3D p = new Vector3D( 0, 0, .5 ); Vector3D p = new Vector3D(0.08, 0.12, 0.07); simplex.Facets = simplex.Facets.Select(f => H3Models.Transform_PointToOrigin(f, p)).ToArray(); simplex.Verts = simplex.Verts.Select(v => H3Models.Transform_PointToOrigin(v, p)).ToArray(); startingEdges = startingEdges.Select(e => new H3.Cell.Edge( H3Models.Transform_PointToOrigin(e.Start, p), H3Models.Transform_PointToOrigin(e.End, p))).ToList(); } SetupBaseHue(fileName, mirrorsString, baseHue); Recurse.m_background = baseHue == -1 ? new Vector3D() : new Vector3D(baseHue, 1, .1); H3.Cell.Edge[] edges = Recurse.CalcEdgesSmart2(simplex.Facets, startingEdges.ToArray(), numEdges); //H3.Cell.Edge[] edges = Recurse.CalcEdges( simplex.Facets, startingEdges.ToArray(), // new Recurse.Settings() { ThreshType = Recurse.EdgeThreshType.Radial, Threshold = H3Models.Ball.FindLocationForDesiredRadius( settings.PovRay.EdgeWidth, 0.8/100 ) } ); //edges = edges.Where( e => e.Depths[0] % 2 == 1 ).ToArray(); // Used for Borromean Rings complement image. // Shapeways truncated 436. if (false) { if (true) { Mobius m = Mobius.Scale(1.0 / H3Models.UHS.ToE(Honeycomb.InRadius(def.P, def.Q, def.R))); double a = -Math.PI / 2 + Math.Asin(1 / Math.Sqrt(3)); edges = edges.Select(e => { Vector3D v1 = e.Start; Vector3D v2 = e.End; v1.RotateAboutAxis(new Vector3D(1, 0, 0), a); v2.RotateAboutAxis(new Vector3D(1, 0, 0), a); v1 = H3Models.Ball.ApplyMobius(m, v1); v2 = H3Models.Ball.ApplyMobius(m, v2); return(new H3.Cell.Edge(v1, v2)); }).ToArray(); double thresh = -.01; Vector3D looking = new Vector3D(0, 0, -1); edges = edges.Where(e => e.Start.Dot(looking) > thresh && e.End.Dot(looking) > thresh).ToArray(); Dictionary <H3.Cell.Edge, int> edgeDict = edges.ToDictionary(e => e, e => 1); H3.RemoveDanglingEdgesRecursive(edgeDict); edges = edgeDict.Keys.ToArray(); } else { Mobius m = Mobius.Scale(2); edges = edges.Select(e => { Vector3D v1 = e.Start; Vector3D v2 = e.End; v1 = H3Models.Ball.ApplyMobius(m, v1); v2 = H3Models.Ball.ApplyMobius(m, v2); return(new H3.Cell.Edge(v1, v2)); }).ToArray(); Dictionary <H3.Cell.Edge, int> edgeDict = edges.ToDictionary(e => e, e => 1); H3.RemoveDanglingEdgesRecursive(edgeDict); edges = edgeDict.Keys.ToArray(); } } //H3.m_settings.Output = H3.Output.STL; //H3.m_settings.Scale = 50; H3.SaveToFile(fileName, edges, finite: true, append: true); bool doCells = false; H3.Cell[] cellsToHighlight = null; if (doCells) { int[] polyMirrors = new int[] { 1, 2, 3 }; active = active.Select(i => mapMirror(i)).OrderBy(i => i).ToArray(); H3.Cell startingCell = PolyhedronToHighlight(Geometry.Hyperbolic, polyMirrors, simplex, startingPoint); cellsToHighlight = Recurse.CalcCells(simplex.Facets, new H3.Cell[] { startingCell }); H3.AppendFacets(fileName, cellsToHighlight); } return(edges); }
/// <summary> /// Our approach will be: /// (1) Generate a portion of one cell. /// (2) Reflect all facets in the central facet, to get things filled-in inside the central facet. (Trim small edges here?) /// (3) Copy this region around the plane, and go back to step (2) if density is not high enough. /// (4) Map to Ball, trimming edges that become too small. /// NOTE: All verts are on the boundary, so we can reflect around // in circles on the plane at infinity, rather than spheres. /// </summary> public static void GenerateExotic(EHoneycomb honeycomb, H3.Settings settings) { settings.AngularThickness = 0.17; Tiling tiling; Tile baseTile; GetAssociatedTiling(honeycomb, out tiling, out baseTile); List <H3.Cell.Edge> edges = new List <H3.Cell.Edge>(); foreach (Segment seg in baseTile.Boundary.Segments) { edges.Add(new H3.Cell.Edge(seg.P1, seg.P2)); } settings.Position = Polytope.Projection.FaceCentered; double scale = 1; Vector3D offset = new Vector3D(); if (settings.Position == Polytope.Projection.FaceCentered) { scale = FaceCenteredScale(baseTile.VertexCircle); offset = new Vector3D(); } else if (settings.Position == Polytope.Projection.EdgeCentered) { scale = EdgeCenteredScale(baseTile); offset = baseTile.Boundary.Segments[0].Midpoint; } int iterations = m_params.Iterations; for (int i = 0; i < iterations; i++) { edges = DoOneStep(edges, tiling, baseTile.VertexCircle); } edges = CopyAndProject(edges, tiling, scale, offset); if (m_params.RemoveDangling) { Dictionary <H3.Cell.Edge, int> edgeDict = edges.ToDictionary(e => e, e => 1); H3.RemoveDanglingEdgesRecursive(edgeDict); edges = edgeDict.Keys.ToList(); } string outputFileName = H3.m_baseDir + Honeycomb.String(honeycomb, false); System.IO.File.Delete(outputFileName); if (m_params.Output == H3.Output.STL) { outputFileName += ".stl"; // Now mesh the edges. Shapeways mesh = new Shapeways(); foreach (H3.Cell.Edge edge in edges) { // Append to the file vs. writing out all at once because I was running out of memory otherwise. mesh = new Shapeways(); int div; H3Models.Ball.LODThin(edge.Start, edge.End, out div); mesh.Div = div; H3.Util.AddToMeshInternal(mesh, edge.Start, edge.End); mesh.Mesh.Scale(settings.Scale); STL.AppendMeshToSTL(mesh.Mesh, outputFileName); } } else { outputFileName += ".pov"; PovRay.WriteH3Edges(new PovRay.Parameters() { AngularThickness = settings.AngularThickness, Halfspace = settings.Halfspace, ThinEdges = settings.ThinEdges, }, edges.ToArray(), outputFileName); } }
private static string H3Facet( H3.Cell cell, HashSet<Sphere> completed ) { StringBuilder sb = new StringBuilder(); foreach( H3.Cell.Facet facet in cell.Facets ) { //if( completed.Contains( facet.Sphere ) ) // continue; // XXX - Hard coding for 535 skew string matString = "sphereMat"; /*if( facet.Verts.Length == 6 ) matString = "sphereMat"; else if( facet.Verts.Length == 5 ) { continue; //matString = "sphereMat2"; } else { throw new System.ArgumentException(); continue; }*/ bool invert1 = !facet.Sphere.IsPointInside( cell.Center ); if( facet.Sphere.Invert ) invert1 = !invert1; //bool invert1 = CheckForInvert( facet.Sphere, cell.Center ); sb.Append( string.Format( "{0} material {{ sphereMat }} clipped_by {{ ball }}", FormatSphereNoMaterial( facet.Sphere, invert1, false ) ) ); H3.Cell.Facet[] others = cell.Facets.Except( new H3.Cell.Facet[] { facet } ).ToArray(); foreach( H3.Cell.Facet otherFacet in others ) { bool invert = !otherFacet.Sphere.IsPointInside( cell.Center ); if( otherFacet.Sphere.Invert ) invert = !invert; //bool invert = CheckForInvert( otherFacet.Sphere, cell.Center ); sb.Append( string.Format( " clipped_by {{ {0} }}", FormatSphereNoMaterial( otherFacet.Sphere, invert ) ) ); } sb.AppendLine( " }" ); completed.Add( facet.Sphere ); } return sb.ToString(); }
private static void ReflectCellsRecursive( Sphere[] simplex, H3.Cell[] cells, Settings settings, List<H3.Cell> completedCells, HashSet<Vector3D> completedCellIds ) { if( 0 == cells.Length ) return; List<H3.Cell> newCells = new List<H3.Cell>(); foreach( H3.Cell cell in cells ) //foreach( Sphere mirror in simplex ) for( int m=0; m<simplex.Length; m++ ) { Sphere mirror = simplex[m]; //if( m == 2 ) // continue; //if( completedCellIds.Count > 1000 ) // return; //if( completedCellIds.Count > settings.MaxEdges/5 ) if( completedCellIds.Count > settings.MaxEdges / 20 ) throw new System.Exception( "Maxing out cells - will result in uneven filling." ); H3.Cell newCell = cell.Clone(); newCell.Reflect( mirror ); if( !CellOk( newCell, settings ) ) continue; // This tracks reflections across the cell facets. newCell.Depths[m]++; if( completedCellIds.Add( newCell.ID ) ) { // Haven't seen this cell yet, so // we'll need to recurse on it. newCells.Add( newCell ); completedCells.Add( newCell ); } } ReflectCellsRecursive( simplex, newCells.ToArray(), settings, completedCells, completedCellIds ); }
/// <summary> /// Our approach will be: /// (1) Generate a portion of one cell. /// (2) Reflect all facets in the central facet, to get things filled-in inside the central facet. (Trim small edges here?) /// (3) Copy this region around the plane, and go back to step (2) if density is not high enough. /// (4) Map to Ball, trimming edges that become too small. /// NOTE: All verts are on the boundary, so we can reflect around // in circles on the plane at infinity, rather than spheres. /// </summary> public static void GenerateExotic( EHoneycomb honeycomb, H3.Settings settings ) { settings.AngularThickness = 0.17; Tiling tiling; Tile baseTile; GetAssociatedTiling( honeycomb, out tiling, out baseTile ); List<H3.Cell.Edge> edges = new List<H3.Cell.Edge>(); foreach( Segment seg in baseTile.Boundary.Segments ) edges.Add( new H3.Cell.Edge( seg.P1, seg.P2 ) ); settings.Position = Polytope.Projection.FaceCentered; double scale = 1; Vector3D offset = new Vector3D(); if( settings.Position == Polytope.Projection.FaceCentered ) { scale = FaceCenteredScale( baseTile.VertexCircle ); offset = new Vector3D(); } else if( settings.Position == Polytope.Projection.EdgeCentered ) { scale = EdgeCenteredScale( baseTile ); offset = baseTile.Boundary.Segments[0].Midpoint; } int iterations = m_params.Iterations; for( int i=0; i<iterations; i++ ) edges = DoOneStep( edges, tiling, baseTile.VertexCircle ); edges = CopyAndProject( edges, tiling, scale, offset ); if( m_params.RemoveDangling ) { Dictionary<H3.Cell.Edge,int> edgeDict = edges.ToDictionary( e => e, e => 1 ); H3.RemoveDanglingEdgesRecursive( edgeDict ); edges = edgeDict.Keys.ToList(); } string outputFileName = H3.m_baseDir + Honeycomb.String( honeycomb, false ); System.IO.File.Delete( outputFileName ); if( m_params.Output == H3.Output.STL ) { outputFileName += ".stl"; // Now mesh the edges. Shapeways mesh = new Shapeways(); foreach( H3.Cell.Edge edge in edges ) { // Append to the file vs. writing out all at once because I was running out of memory otherwise. mesh = new Shapeways(); int div; H3Models.Ball.LODThin( edge.Start, edge.End, out div ); mesh.Div = div; H3.Util.AddToMeshInternal( mesh, edge.Start, edge.End ); mesh.Mesh.Scale( settings.Scale ); STL.AppendMeshToSTL( mesh.Mesh, outputFileName ); } } else { outputFileName += ".pov"; PovRay.WriteH3Edges( new PovRay.Parameters() { AngularThickness = settings.AngularThickness, Halfspace = settings.Halfspace, ThinEdges = settings.ThinEdges, }, edges.ToArray(), outputFileName ); } }
public override void WriteTo(HTMLBase parent, int depth, AmendmentBuilder builder) { if (Group) { parent.Children.Add(new Div(cls: "LegClearPblock")); parent.Children.Add(new H2(cls: "LegPblock") { Children = { new Span(cls: "LegPblockTitle") { RawText = getAmendedText(builder) } } }); return; } var LHS = new Span(cls: $"LegDS LegP{depth}No") { RawText = Number }; var RHS = new Span(cls: $"LegDS LegP{depth}GroupTitle") { RawText = getAmendedText(builder) }; var header = new H3($"section-{Number}", $"LegClearFix LegP{depth}Container{(Number == "1" ? "First" : "")}") { Children = { new Anchor("", id: AnchorText), LHS, RHS } }; parent.Children.Add(header); if (RepealedById.HasValue) { var amend = Law.AmendmentReferences[RepealedById.Value]; var next = builder.GetNextNumber(new ThingAmendment(this, RepealedById.Value, AmendType.Repeal)); RHS.RawText = builder.TextOnly ? "..." : ". . . ." + LegHelpers.GetChangeAnchor(next); return; } else if (Substituted != null) { parent.Children.RemoveAt(parent.Children.Count - 1); // remove p, since we'll refer to the substituted Substituted.New.Register(Parent); Substituted.New.Number = Number; Substituted.New.SubstituedById = Substituted.GroupId; Substituted.New.WriteTo(parent, depth, builder); return; } else if (SubstituedById.HasValue && Parent.SubstituedById != SubstituedById) { var next = builder.GetNextNumber(new ThingAmendment(this, SubstituedById.Value, AmendType.Substitute)); LHS.RawText = (builder.TextOnly ? "" : $"{LegHelpers.GetChangeDeliminator(true)}{LegHelpers.GetChangeAnchor(next)}") + $"{Number}"; } else if (InsertedById.HasValue) { var amend = Law.AmendmentReferences[InsertedById.Value]; var next = builder.GetNextNumber(new ThingAmendment(this, InsertedById.Value, AmendType.Insert)); LHS.RawText = (builder.TextOnly ? "" : $"{LegHelpers.GetChangeDeliminator(true)}{LegHelpers.GetChangeAnchor(next)}") + $"{Number}"; } var children = new List <TextualLawThing>(); children.AddRange(Children); foreach (var child in children.OrderBy(x => x.Number, new NumberComparer())) { child.WriteTo(parent, depth + 1, builder); } if (!builder.TextOnly && ( InsertedById.HasValue || SubstituedById.HasValue ) ) { var last = parent.Children[^ 1];
/// <summary> /// Traz dados da Fase para o Menu de Tentativas /// </summary> /// <param name="GC">Controlador do Game</param> public void F_AttemptsMenu(GameController GC) //Função referente à "tela" de tentativas { if (GC.attempts != 0) { imgMenuT.SetActive(true); ///------------------/// ///------------------/// ///------------------/// if (GC.attempts == 1) { cli1_1.text = GC.click1[0]; cli2_1.text = GC.click2[0]; if (GC.result[0] == "F") { F1.SetActive(true); F1.transform.localPosition = new Vector3(-112, 231, 0); H1.SetActive(false); } if (GC.result[0] == "H") { H1.SetActive(true); H1.transform.localPosition = new Vector3(-112, 231, 0); F1.SetActive(false); } else if (GC.result[0] == "HH") { H1.SetActive(true); H11.SetActive(true); H1.transform.localPosition = new Vector3(-201, 231, 0); H11.transform.localPosition = new Vector3(-112, 231, 0); } ///------------------/// } else if (GC.attempts == 2) { //--------------// cli1_1.text = GC.click1[0]; cli2_1.text = GC.click2[0]; ///------------------/// cli1_2.text = GC.click1[1]; cli2_2.text = GC.click2[1]; if (GC.result[0] == "F") { F1.SetActive(true); F1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); H1.SetActive(false); } if (GC.result[0] == "H") { H1.SetActive(true); H1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); F1.SetActive(false); } else if (GC.result[0] == "HH") { H1.SetActive(true); H11.SetActive(true); H1.transform.localPosition = new Vector3(-201, 231, 0); H11.transform.localPosition = new Vector3(-112, 231, 0); } ///------------------/// ///------------------/// if (GC.result[1] == "F") { F2.SetActive(true); F2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); H2.SetActive(false); } if (GC.result[1] == "H") { H2.SetActive(true); H2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); F2.SetActive(false); } else if (GC.result[1] == "HH") { H2.SetActive(true); H22.SetActive(true); H2.transform.localPosition = new Vector3(-201, 127, 0); H22.transform.localPosition = new Vector3(-112, 127, 0); } } else if (GC.attempts == 3) { //--------------// cli1_1.text = GC.click1[0]; cli2_1.text = GC.click2[0]; ///------------------/// cli1_2.text = GC.click1[1]; cli2_2.text = GC.click2[1]; ///------------------/// cli1_3.text = GC.click1[2]; cli2_3.text = GC.click2[2]; if (GC.result[0] == "F") { F1.SetActive(true); F1.transform.localPosition = new Vector3(-112, 231, 0); H1.SetActive(false); } if (GC.result[0] == "H") { H1.SetActive(true); H1.transform.localPosition = new Vector3(-112, 231, 0); F1.SetActive(false); } else if (GC.result[0] == "HH") { H1.SetActive(true); H11.SetActive(true); H1.transform.localPosition = new Vector3(-201, 231, 0); H11.transform.localPosition = new Vector3(-112, 231, 0); } ///------------------/// ///------------------/// if (GC.result[1] == "F") { F2.SetActive(true); F2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); H2.SetActive(false); } if (GC.result[1] == "H") { H2.SetActive(true); H2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); F2.SetActive(false); } else if (GC.result[1] == "HH") { H2.SetActive(true); H22.SetActive(true); H2.transform.localPosition = new Vector3(-201, 127, 0); H22.transform.localPosition = new Vector3(-112, 127, 0); } ///------------------/// if (GC.result[2] == "F") { F3.SetActive(true); F3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); H3.SetActive(false); } if (GC.result[2] == "H") { H3.SetActive(true); H3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); F3.SetActive(false); } else if (GC.result[2] == "HH") { H3.SetActive(true); H33.SetActive(true); H3.transform.localPosition = new Vector3(-201, 26, 0); H33.transform.localPosition = new Vector3(-112, 26, 0); } } //**************************// else if (GC.attempts == 4) { cli1_1.text = GC.click1[0]; cli2_1.text = GC.click2[0]; ///------------------/// cli1_2.text = GC.click1[1]; cli2_2.text = GC.click2[1]; ///------------------/// cli1_3.text = GC.click1[2]; cli2_3.text = GC.click2[2]; ///------------------/// cli1_4.text = GC.click1[3]; cli2_4.text = GC.click2[3]; /// ///------------------//////------------------//////------------------/// if (GC.result[0] == "F") { F1.SetActive(true); F1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); H1.SetActive(false); } if (GC.result[0] == "H") { H1.SetActive(true); H1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); F1.SetActive(false); } else if (GC.result[0] == "HH") { H1.SetActive(true); H11.SetActive(true); H1.transform.localPosition = new Vector3(-201, 231, 0); H11.transform.localPosition = new Vector3(-112, 231, 0); } ///------------------/// ///------------------/// if (GC.result[1] == "F") { F2.SetActive(true); F2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); H2.SetActive(false); } if (GC.result[1] == "H") { H2.SetActive(true); H2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); F2.SetActive(false); } else if (GC.result[1] == "HH") { H2.SetActive(true); H22.SetActive(true); H2.transform.localPosition = new Vector3(-201, 127, 0); H22.transform.localPosition = new Vector3(-112, 127, 0); } ///------------------/// if (GC.result[2] == "F") { F3.SetActive(true); F3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); H3.SetActive(false); } if (GC.result[2] == "H") { H3.SetActive(true); H3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); F3.SetActive(false); } else if (GC.result[2] == "HH") { H3.SetActive(true); H33.SetActive(true); H3.transform.localPosition = new Vector3(-201, 26, 0); H33.transform.localPosition = new Vector3(-112, 26, 0); } ///------------------/// if (GC.result[3] == "F") { F4.SetActive(true); F4.transform.localPosition = new Vector3(-112, -70, 0); H44.SetActive(false); H4.SetActive(false); } if (GC.result[3] == "H") { H4.SetActive(true); H4.transform.localPosition = new Vector3(-112, -70, 0); H44.SetActive(false); F4.SetActive(false); } else if (GC.result[3] == "HH") { H4.SetActive(true); H4.transform.localPosition = new Vector3(-201, -70, 0); H44.SetActive(true); H44.transform.localPosition = new Vector3(-112, -70, 0); } ///------------------/// } ///------------------//////------------------//////------------------//////------------------//////------------------/// else if (GC.attempts == 5) { cli1_1.text = GC.click1[0]; cli2_1.text = GC.click2[0]; ///------------------/// cli1_2.text = GC.click1[1]; cli2_2.text = GC.click2[1]; ///------------------/// cli1_3.text = GC.click1[2]; cli2_3.text = GC.click2[2]; ///------------------/// cli1_4.text = GC.click1[3]; cli2_4.text = GC.click2[3]; ///------------------/// cli1_5.text = GC.click1[4]; cli2_5.text = GC.click2[4]; ///------------------/// ///------------------//////------------------//////------------------/// if (GC.result[0] == "F") { F1.SetActive(true); F1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); H1.SetActive(false); } if (GC.result[0] == "H") { H1.SetActive(true); H1.transform.localPosition = new Vector3(-112, 231, 0); H11.SetActive(false); F1.SetActive(false); } else if (GC.result[0] == "HH") { H1.SetActive(true); H11.SetActive(true); H1.transform.localPosition = new Vector3(-201, 231, 0); H11.transform.localPosition = new Vector3(-112, 231, 0); } ///------------------/// ///------------------/// if (GC.result[1] == "F") { F2.SetActive(true); F2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); H2.SetActive(false); } if (GC.result[1] == "H") { H2.SetActive(true); H2.transform.localPosition = new Vector3(-112, 127, 0); H22.SetActive(false); F2.SetActive(false); } else if (GC.result[1] == "HH") { H2.SetActive(true); H22.SetActive(true); H2.transform.localPosition = new Vector3(-201, 127, 0); H22.transform.localPosition = new Vector3(-112, 127, 0); } ///------------------/// ///------------------/// if (GC.result[2] == "F") { F3.SetActive(true); F3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); H3.SetActive(false); } if (GC.result[2] == "H") { H3.SetActive(true); H3.transform.localPosition = new Vector3(-112, 26, 0); H33.SetActive(false); F3.SetActive(false); } else if (GC.result[2] == "HH") { H3.SetActive(true); H33.SetActive(true); H3.transform.localPosition = new Vector3(-201, 26, 0); H33.transform.localPosition = new Vector3(-112, 26, 0); } ///------------------/// if (GC.result[3] == "F") { F4.SetActive(true); F4.transform.localPosition = new Vector3(-112, -70, 0); H44.SetActive(false); H4.SetActive(false); } if (GC.result[3] == "H") { H4.SetActive(true); H4.transform.localPosition = new Vector3(-112, -70, 0); H44.SetActive(false); F4.SetActive(false); } else if (GC.result[3] == "HH") { H4.SetActive(true); H4.transform.localPosition = new Vector3(-201, -70, 0); H44.SetActive(true); H44.transform.localPosition = new Vector3(-112, -70, 0); } ///------------------/// if (GC.result[4] == "F") { F5.SetActive(true); F5.transform.localPosition = new Vector3(-112, -178, 0); H55.SetActive(false); H5.SetActive(false); } if (GC.result[4] == "H") { H5.SetActive(true); H5.transform.localPosition = new Vector3(-112, -178, 0); H55.SetActive(false); F5.SetActive(false); } else if (GC.result[4] == "HH") { H4.SetActive(true); H44.SetActive(true); H4.transform.localPosition = new Vector3(-201, 231, 0); H44.transform.localPosition = new Vector3(-112, 231, 0); } } } }
/// <summary> /// LOD /// </summary> public static void LOD_Finite( Vector3D e1, Vector3D e2, out int div1, out int div2, H3.Settings settings ) { //if( settings.Halfspace ) // throw new System.NotImplementedException(); int maxHit = 15; int hit = (int)( Math.Max( e1.Abs(), e2.Abs() ) * maxHit ); div1 = 11; div2 = 30 - hit; /* lasercrystal int maxHit = 8; int hit = (int)( Math.Max( e1.Abs(), e2.Abs() ) * maxHit ); div1 = 6; div2 = 20 - hit;*/ }
public static void vZome( H3.Cell.Edge[] edges ) { foreach( var e in edges ) { throw new System.NotImplementedException(); } }
public static void LOD_Ideal( Vector3D e1, Vector3D e2, out int div1, out int div2, H3.Settings settings ) { if( settings.Halfspace ) throw new System.NotImplementedException(); div1 = 13; div2 = (int)( 5 + Math.Sqrt( e1.Dist( e2 ) ) * 10 ); }
/// <summary> /// Calculate the hyperbolic midpoint of an edge. /// Only works for non-ideal edges at the moment. /// </summary> public static Vector3D Midpoint( H3.Cell.Edge edge ) { // Special case if edge has endpoint on origin. // XXX - Really this should be special case anytime edge goes through origin. Vector3D e1 = edge.Start; Vector3D e2 = edge.End; if( e1.IsOrigin || e2.IsOrigin ) { if( e2.IsOrigin ) Utils.Swap<Vector3D>( ref e1, ref e2 ); return HalfTo( e2 ); } // No doubt there is a much better way, but // work in H2 slice transformed to xy plane, with e1 on x-axis. double angle = e1.AngleTo( e2 ); // always <= 180 e1 = new Vector3D( e1.Abs(), 0 ); e2 = new Vector3D( e2.Abs(), 0 ); e2.RotateXY( angle ); // Mobius that will move e1 to origin. Mobius m = new Mobius(); m.Isometry( Geometry.Hyperbolic, 0, -e1 ); e2 = m.Apply( e2 ); Vector3D midOnPlane = HalfTo( e2 ); midOnPlane= m.Inverse().Apply( midOnPlane ); double midAngle = e1.AngleTo( midOnPlane ); Vector3D mid = edge.Start; mid.RotateAboutAxis( edge.Start.Cross( edge.End ), midAngle ); mid.Normalize( midOnPlane.Abs() ); return mid; }
/// <summary> /// Face centered orientation. /// </summary> private static void FCOrient( H3.Cell cell ) { // First, need to scale so the lowest triangles are the same size, // then reorient so that one triangle is oriented along z axis, // then scale so that the triangle is flat. // Rotation - not what we want. if( false ) { Vector3D direction = cell.Facets[0].Sphere.Center; Vector3D southPole = new Vector3D( 0, 0, -1 ); Vector3D axis = direction.Cross( southPole ); double mag = direction.AngleTo( southPole ); foreach( Sphere s in cell.Facets.Select( f => f.Sphere ) ) Sphere.RotateSphere( s, axis, mag ); Vector3D newCen = cell.Center; newCen.RotateAboutAxis( axis, mag ); cell.Center = newCen; } if( true ) { // Calculate how much we need to offset to make the cell facet flat. Mobius m = FCOrientMobius( cell.Facets[0].Sphere ); foreach( H3.Cell.Facet f in cell.Facets ) H3Models.TransformInBall2( f.Sphere, m ); cell.Center = H3Models.TransformHelper( cell.Center, m ); } }
private static void CullHalfOfEdges( ref H3.Cell.Edge[] edges ) { double thresh = -.01; Vector3D looking = new Vector3D( 0, 0, -1 ); edges = edges.Where( e => e.Start.Dot( looking ) > thresh || e.End.Dot( looking ) > thresh ).ToArray(); }
public HTMLItem Convert(FB2File fb2File, ConverterOptionsV3 settings) { if (fb2File == null) { throw new ArgumentNullException("fb2File"); } var info = new Div(HTMLElementType.HTML5); var header = new H3(HTMLElementType.HTML5); header.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = "FB2 document info" }); info.Add(header); if (fb2File.DocumentInfo != null) { if (!string.IsNullOrEmpty(fb2File.DocumentInfo.ID)) { var p = new Paragraph(HTMLElementType.HTML5); p.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = string.Format("Document ID: {0}", fb2File.DocumentInfo.ID) }); info.Add(p); } if (fb2File.DocumentInfo.DocumentVersion.HasValue) { var p = new Paragraph(HTMLElementType.HTML5); p.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = string.Format("Document version: {0}", fb2File.DocumentInfo.DocumentVersion) }); info.Add(p); } if ((fb2File.DocumentInfo.DocumentDate != null) && !string.IsNullOrEmpty(fb2File.DocumentInfo.DocumentDate.Text)) { var p = new Paragraph(HTMLElementType.HTML5); p.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = string.Format("Document creation date: {0}", fb2File.DocumentInfo.DocumentDate.Text) }); info.Add(p); } if ((fb2File.DocumentInfo.ProgramUsed2Create != null) && !string.IsNullOrEmpty(fb2File.DocumentInfo.ProgramUsed2Create.Text)) { var p = new Paragraph(HTMLElementType.HTML5); p.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = string.Format("Created using: {0} software", fb2File.DocumentInfo.ProgramUsed2Create.Text) }); info.Add(p); } if ((fb2File.DocumentInfo.SourceOCR != null) && !string.IsNullOrEmpty(fb2File.DocumentInfo.SourceOCR.Text)) { var p = new Paragraph(HTMLElementType.HTML5); p.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = string.Format("OCR Source: {0}", fb2File.DocumentInfo.SourceOCR.Text) }); info.Add(p); } if ((fb2File.DocumentInfo.DocumentAuthors != null) && (fb2File.DocumentInfo.DocumentAuthors.Count > 0)) { var heading = new H4(HTMLElementType.HTML5); heading.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = "Document authors :" }); info.Add(heading); var authors = new UnorderedList(HTMLElementType.HTML5); foreach (var author in fb2File.DocumentInfo.DocumentAuthors) { var li = new ListItem(HTMLElementType.HTML5); li.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = DescriptionConverters.GetAuthorAsSting(author) }); authors.Add(li); } info.Add(authors); } if ((fb2File.DocumentInfo.DocumentPublishers != null) && (fb2File.DocumentInfo.DocumentPublishers.Count > 0)) { var heading = new H4(HTMLElementType.HTML5); heading.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = "Document publishers :" }); info.Add(heading); var publishers = new UnorderedList(HTMLElementType.HTML5); foreach (var publisher in fb2File.DocumentInfo.DocumentPublishers) { var li = new ListItem(HTMLElementType.HTML5); li.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = DescriptionConverters.GetAuthorAsSting(publisher) }); publishers.Add(li); } info.Add(publishers); } if ((fb2File.DocumentInfo.SourceURLs != null) && (fb2File.DocumentInfo.SourceURLs.Any())) { var heading = new H4(HTMLElementType.HTML5); heading.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = "Source URLs :" }); info.Add(heading); var urls = new UnorderedList(HTMLElementType.HTML5); foreach (var url in fb2File.DocumentInfo.SourceURLs) { var li = new ListItem(HTMLElementType.HTML5); if (ReferencesUtils.IsExternalLink(url)) { var link = new Anchor(HTMLElementType.HTML5); link.HRef.Value = url; link.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = url }); li.Add(link); } else { li.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = url }); } urls.Add(li); } info.Add(urls); } if (fb2File.DocumentInfo.History != null) { var heading = new H4(HTMLElementType.HTML5); heading.Add(new SimpleHTML5Text(HTMLElementType.HTML5) { Text = "Document history:" }); info.Add(heading); var annotationConverter = new AnnotationConverterV3(); info.Add(annotationConverter.Convert(fb2File.DocumentInfo.History, new AnnotationConverterParamsV3 { Level = 1, Settings = settings })); //Paragraph p = new Paragraph(); //p.Add(new SimpleHTML5Text() { Text = fb2File.DocumentInfo.History.ToString() }); //info.Add(p); } } // in case there is no elements - no need for a header if (info.SubElements().Count <= 1) { info.Remove(header); } SetClassType(info, ElementStylesV3.FB2Info); return(info); }
/// <summary> /// This generates a polyhedron using recursion. It needs to be finite /// (There are not any other breakouts of the recursion, other than all facets having been generated.) /// </summary> public static void GenPolyhedron( Sphere[] mirrors, H3.Cell.Facet[] facets, List<H3.Cell.Facet> completedFacets, HashSet<Vector3D> completedFacetIds ) { if( 0 == facets.Length ) return; List<H3.Cell.Facet> newFacets = new List<H3.Cell.Facet>(); foreach( H3.Cell.Facet facet in facets ) foreach( Sphere mirror in mirrors ) { H3.Cell.Facet newFacet = facet.Clone(); newFacet.Reflect( mirror ); if( completedFacetIds.Add( newFacet.ID ) ) { // Haven't seen this facet yet, so // we'll need to recurse on it. newFacets.Add( newFacet ); completedFacets.Add( newFacet ); } } GenPolyhedron( mirrors, newFacets.ToArray(), completedFacets, completedFacetIds ); }
public static void Generate(EHoneycomb honeycomb, H3.Settings settings) { // XXX - Block the same as in H3. Share code better. H3.Cell template = null; { int p, q, r; Honeycomb.PQR(honeycomb, out p, out q, out r); // Get data we need to generate the honeycomb. Polytope.Projection projection = Polytope.Projection.FaceCentered; double phi, chi, psi; H3.HoneycombData(honeycomb, out phi, out chi, out psi); H3.SetupCentering(honeycomb, settings, phi, chi, psi, ref projection); Tiling tiling = new Tiling(); TilingConfig config = new TilingConfig(p, q); tiling.GenerateInternal(config, projection); H3.Cell first = new H3.Cell(p, H3.GenFacets(tiling)); first.ToSphere(); // Work in ball model. first.ScaleToCircumSphere(1.0); first.ApplyMobius(settings.Mobius); template = first; } // Center Vector3D center = template.Center; // Face H3.Cell.Facet facet = template.Facets[0]; Sphere s = H3Models.Ball.OrthogonalSphereInterior(facet.Verts[0], facet.Verts[1], facet.Verts[2]); Vector3D face = s.Center; face.Normalize(); face *= DistOriginToOrthogonalSphere(s.Radius); // Edge Circle3D c; H3Models.Ball.OrthogonalCircleInterior(facet.Verts[0], facet.Verts[1], out c); Vector3D edge = c.Center; edge.Normalize(); edge *= DistOriginToOrthogonalSphere(c.Radius); // Vertex Vector3D vertex = facet.Verts[0]; Tet fundamental = new Tet(center, face, edge, vertex); // Recurse. int level = 1; Dictionary <Tet, int> completedTets = new Dictionary <Tet, int>(new TetEqualityComparer()); completedTets.Add(fundamental, level); List <Tet> tets = new List <Tet>(); tets.Add(fundamental); ReflectRecursive(level, tets, completedTets, settings); Shapeways mesh = new Shapeways(); foreach (KeyValuePair <Tet, int> kvp in completedTets) { if (Utils.Odd(kvp.Value)) { continue; } Tet tet = kvp.Key; // XXX - really want sphere surfaces here. mesh.Mesh.Triangles.Add(new Mesh.Triangle(tet.Verts[0], tet.Verts[1], tet.Verts[2])); mesh.Mesh.Triangles.Add(new Mesh.Triangle(tet.Verts[0], tet.Verts[3], tet.Verts[1])); mesh.Mesh.Triangles.Add(new Mesh.Triangle(tet.Verts[0], tet.Verts[2], tet.Verts[3])); mesh.Mesh.Triangles.Add(new Mesh.Triangle(tet.Verts[1], tet.Verts[3], tet.Verts[2])); } mesh.Mesh.Scale(settings.Scale); STL.SaveMeshToSTL(mesh.Mesh, H3.m_baseDir + "fundamental" + ".stl"); }
/// <summary> /// Add an ideal banana to our mesh. Passed in edge should be in Ball model. /// </summary> public static void AddIdealBanana( Shapeways mesh, Vector3D e1, Vector3D e2, H3.Settings settings ) { Vector3D z1 = H3Models.BallToUHS( e1 ); Vector3D z2 = H3Models.BallToUHS( e2 ); // Mobius taking z1,z2 to origin,inf Complex dummy = new Complex( Math.E, Math.PI ); Mobius m = new Mobius( z1, dummy, z2 ); // Make our truncated cone. We need to deal with the two ideal endpoints specially. List<Vector3D> points = new List<Vector3D>(); double logHeight = 2; // XXX - magic number, and going to cause problems for infinity checks if too big. int div1, div2; H3Models.Ball.LOD_Ideal( e1, e2, out div1, out div2, settings ); double increment = logHeight / div1; for( int i=-div1; i<=div1; i+=2 ) points.Add( new Vector3D( 0, 0, Math.Exp( increment * i ) ) ); Shapeways tempMesh = new Shapeways(); tempMesh.Div = div2; System.Func<Vector3D, double> sizeFunc = v => H3Models.UHS.SizeFunc( v, settings.AngularThickness ); //Mesh.OpenCylinder... pass in two ideal endpoints? tempMesh.AddCurve( points.ToArray(), sizeFunc, new Vector3D(), Infinity.InfinityVector ); // Unwind the transforms. TakePointsBack( tempMesh.Mesh, m.Inverse(), settings ); mesh.Mesh.Triangles.AddRange( tempMesh.Mesh.Triangles ); }
// Update is called once per frame void Update() { timer += Time.deltaTime; //Where invincibility frames get handled if (Counter > 0) { Counter--; } H1.SetActive(Lives >= 1); H2.SetActive(Lives >= 2); H3.SetActive(Lives == 3); if (Lives == 0) { Dead = true; } if (timer > 7) { Color col = GetComponent <Renderer>().material.color; float r = currentColor.r / 10; float g = currentColor.g / 10; float b = currentColor.b / 10; if (col.r >= 1 && col.g >= 1 && col.b >= 1) { flashUp = false; } else if (col.r <= currentColor.r && col.g <= currentColor.g && col.b <= currentColor.b) { flashUp = true; } if (flashUp) { GetComponent <Renderer>().material.color = new Color(col.r + 0.05f, col.g + 0.05f, col.b + 0.05f); } else { GetComponent <Renderer>().material.color = new Color(col.r - 0.05f, col.g - 0.05f, col.b - 0.05f); } if (timer > 10 && col.r <= currentColor.r && col.g <= currentColor.g && col.b <= currentColor.b) { changeCape(); timer = 0; } } else { currentColor = GetComponent <Renderer>().material.color; } //Makes sure that the collected souls cap out at 10 AmountOfSouls = AmountOfSouls >= MaxAmountOfSouls ? MaxAmountOfSouls : AmountOfSouls; GameObject.Find("SoulScore").GetComponent <Text>().text = "" + AmountOfSouls; SoulScoreBar.fillAmount = AmountOfSouls / 10f; ChangeColor.color = GetComponent <Renderer>().material.color; }
internal static void TakePointsBack( Mesh mesh, Mobius m, H3.Settings settings ) { for( int i=0; i<mesh.Triangles.Count; i++ ) { mesh.Triangles[i] = new Mesh.Triangle( m.ApplyToQuaternion( mesh.Triangles[i].a ), m.ApplyToQuaternion( mesh.Triangles[i].b ), m.ApplyToQuaternion( mesh.Triangles[i].c ) ); /*if( Infinity.IsInfinite( mesh.Triangles[i].a ) || Infinity.IsInfinite( mesh.Triangles[i].b ) || Infinity.IsInfinite( mesh.Triangles[i].c ) ) System.Diagnostics.Debugger.Break();*/ } // Take all points back to Ball, if needed. if( !settings.Halfspace ) { for( int i=0; i<mesh.Triangles.Count; i++ ) { mesh.Triangles[i] = new Mesh.Triangle( H3Models.UHSToBall( mesh.Triangles[i].a ), H3Models.UHSToBall( mesh.Triangles[i].b ), H3Models.UHSToBall( mesh.Triangles[i].c ) ); } } }
/// <summary> /// A helper for adding a sphere. center should be passed in the ball model. /// The approach is similar to how we do the bananas below. /// </summary> public static void AddSphere( Shapeways mesh, Vector3D center, H3.Settings settings ) { Vector3D centerUHS = H3Models.BallToUHS( center ); // Find the Mobius we need. // We'll do this in two steps. // (1) Find a mobius taking center to (0,0,h). // (2) Deal with scaling to a height of 1. Vector3D flattened = centerUHS; flattened.Z = 0; Mobius m1 = new Mobius( flattened, Complex.One, Infinity.InfinityVector ); Vector3D centerUHS_transformed = m1.ApplyToQuaternion( centerUHS ); double scale = 1.0 / centerUHS_transformed.Z; Mobius m2 = new Mobius( scale, Complex.Zero, Complex.Zero, Complex.One ); Mobius m = m2 * m1; // Compose them (multiply in reverse order). // Add the sphere at the Ball origin. // It will *always* be generated with the same radius. Shapeways tempMesh = new Shapeways(); tempMesh.AddSphere( new Vector3D(), H3Models.Ball.SizeFunc( new Vector3D(), settings.AngularThickness ) ); // Unwind the transforms. for( int i=0; i<tempMesh.Mesh.Triangles.Count; i++ ) { tempMesh.Mesh.Triangles[i] = new Mesh.Triangle( H3Models.BallToUHS( tempMesh.Mesh.Triangles[i].a ), H3Models.BallToUHS( tempMesh.Mesh.Triangles[i].b ), H3Models.BallToUHS( tempMesh.Mesh.Triangles[i].c ) ); } Banana.TakePointsBack( tempMesh.Mesh, m.Inverse(), settings ); mesh.Mesh.Triangles.AddRange( tempMesh.Mesh.Triangles ); }
public override unsafe void TransformBlock(ReadOnlyMemory <byte> memory) { var length = memory.Length; if (length == 0) { return; } base.TransformBlock(memory); int remainder = length & 15; int blocks = length / 16; using var hMemory = memory.Pin(); byte *d = (byte *)hMemory.Pointer; uint *current = (uint *)d; while (blocks-- > 0) { // K1 - consume first integer H1 ^= (*current++ *C1).RotateLeft(15) * C2; H1 = (H1.RotateLeft(19) + H2) * 5 + 0x561ccd1b; // K2 - consume second integer H2 ^= (*current++ *C2).RotateLeft(16) * C3; H2 = (H2.RotateLeft(17) + H3) * 5 + 0x0bcaa747; // K3 - consume third integer H3 ^= (*current++ *C3).RotateLeft(17) * C4; H3 = (H3.RotateLeft(15) + H4) * 5 + 0x96cd1c35; // K4 - consume fourth integer H4 ^= (*current++ *C4).RotateLeft(18) * C1; H4 = (H4.RotateLeft(13) + H1) * 5 + 0x32ac3b17; } if (remainder > 0) { // create our keys and initialize to 0 uint k1 = 0, k2 = 0, k3 = 0, k4 = 0; byte *tail = d + (length - remainder); // determine how many bytes we have left to work with based on length switch (remainder) { case 15: k4 ^= (uint)tail[14] << 16; goto case 14; case 14: k4 ^= (uint)tail[13] << 8; goto case 13; case 13: k4 ^= (uint)tail[12] << 0; goto case 12; case 12: k3 ^= (uint)tail[11] << 24; goto case 11; case 11: k3 ^= (uint)tail[10] << 16; goto case 10; case 10: k3 ^= (uint)tail[9] << 8; goto case 9; case 9: k3 ^= (uint)tail[8] << 0; goto case 8; case 8: k2 ^= (uint)tail[7] << 24; goto case 7; case 7: k2 ^= (uint)tail[6] << 16; goto case 6; case 6: k2 ^= (uint)tail[5] << 8; goto case 5; case 5: k2 ^= (uint)tail[4] << 0; goto case 4; case 4: k1 ^= (uint)tail[3] << 24; goto case 3; case 3: k1 ^= (uint)tail[2] << 16; goto case 2; case 2: k1 ^= (uint)tail[1] << 8; goto case 1; case 1: k1 ^= (uint)tail[0] << 0; break; } H4 ^= (k4 * C4).RotateLeft(18) * C1; H3 ^= (k3 * C3).RotateLeft(17) * C4; H2 ^= (k2 * C2).RotateLeft(16) * C3; H1 ^= (k1 * C1).RotateLeft(15) * C2; } }
public override void GenerateBody() { base.GenerateBody(); var titlePage = new Div(Compatibility); titlePage.GlobalAttributes.Class.Value = ElementStylesV2.TitlePage; if (!string.IsNullOrEmpty(BookTitle)) { // try to use FB2 book's title var p = new H2(Compatibility); p.Add(new SimpleHTML5Text(Compatibility) { Text = BookTitle }); p.GlobalAttributes.Class.Value = string.Format(ElementStylesV2.TitleItemFormat, 1); titlePage.Add(p); } else { titlePage.Add(new SimpleHTML5Text(Compatibility) { Text = "Unnamed" }); } titlePage.Add(new EmptyLine(Compatibility)); var sbSeries = new StringBuilder(); foreach (var serie in _series) { if (!string.IsNullOrEmpty(sbSeries.ToString())) { sbSeries.Append(" , "); } sbSeries.Append(serie); } if (sbSeries.ToString() != string.Empty) { var seriesItem = new SimpleHTML5Text(Compatibility) { Text = string.Format("( {0} )", sbSeries) }; var containingText = new EmphasisedText(Compatibility); containingText.Add(seriesItem); var seriesHeading = new H3(Compatibility); seriesHeading.GlobalAttributes.Class.Value = ElementStylesV2.TitleSeries; seriesHeading.Add(containingText); titlePage.Add(seriesHeading); } foreach (var author in _authors) { var authorsHeading = new H3(Compatibility); var authorLine = new SimpleHTML5Text(Compatibility) { Text = author }; authorsHeading.Add(authorLine); authorsHeading.GlobalAttributes.Class.Value = ElementStylesV2.TitleAuthors; titlePage.Add(authorsHeading); } BodyElement.Add(titlePage); }
public static void OneHoneycombGoursat(int[] active, string baseName, int baseHue, Settings settings = null) { // Setup parameters. int numEdges = 250000; if (settings != null) { active = settings.PovRay.Active; numEdges = settings.PovRay.NumEdges; baseName = string.Join("-", settings.Angles); } CalcThickness(active); if (settings != null) { H3.m_settings.AngularThickness = settings.PovRay.EdgeWidth; // ZZZ - should really stop using that settings class. } // Create the simplex. Simplex simplex = new Simplex(); if (settings != null) { simplex.InitializeGoursat(settings.Angles); } else { simplex.InitializeGoursat(); } // Map of labels for mirrors consistent with input scheme to Goursat function. // Map is from wikipedia labeling scheme to the indices our function generates. // // wiki == our index // 0100 == 0 // 0001 == 1 // 1000 == 2 // 0010 == 3 Func <int, int> mapMirror = i => { switch (i) { case 0: return(2); case 1: return(0); case 2: return(3); case 3: return(1); } throw new System.ArgumentException(); }; // We need to set this up before converting the mirrors. string mirrorsString = ActiveMirrorsString(active); string suffix = "_" + mirrorsString; // Convert our active mirrors into the Goursat tet indices. int[] polyMirrors = new int[] { 1, 2, 3 }; active = active.Select(i => mapMirror(i)).OrderBy(i => i).ToArray(); polyMirrors = polyMirrors.Select(i => mapMirror(i)).OrderBy(i => i).ToArray(); Vector3D startingPoint = IterateToStartingPoint(null, active, simplex); List <H3.Cell.Edge> startingEdges = new List <H3.Cell.Edge>(); foreach (int a in active) { Vector3D reflected = simplex.ReflectInFacet(startingPoint, a); startingEdges.Add(new H3.Cell.Edge(startingPoint, reflected)); } bool doEdges = true; bool doCells = false; // Generate the honeycomb. H3.Cell.Edge[] edges = null; if (doEdges) { edges = Recurse.CalcEdgesSmart(simplex.Facets, startingEdges.ToArray(), numEdges); } // Highlighted cells. H3.Cell[] cellsToHighlight = null; if (doCells) { H3.Cell startingCell = PolyhedronToHighlight(Geometry.Hyperbolic, polyMirrors, simplex, startingPoint); cellsToHighlight = Recurse.CalcCells(simplex.Facets, new H3.Cell[] { startingCell }); //cellsToHighlight = new H3.Cell[] { startingCell }; } // plugin Wendy's nonuniform calcs here... //Nonuniform.Wendy( simplex, edges ); // Trim out half the edges (the ones we won't see in our Pov-Ray view). /*Vector3D lookFrom = new Vector3D( 1, 1, 1 ) * 0.7; * Vector3D lookAt = new Vector3D(); // pov-ray lookat * double thresh = -.01; * if( doEdges ) * edges = edges.Where( e => e.Start.Dot( lookAt ) > thresh || e.End.Dot( lookAt ) > thresh ).ToArray(); * //if( doCells ) * // cellsToHighlight = cellsToHighlight.Where( c => c.Center.Dot( lookAt ) > thresh ).ToArray(); // I don't think this works right */ string fileName = baseName + suffix; if (File.Exists(fileName + ".pov")) { File.Delete(fileName + ".pov"); //Console.WriteLine( string.Format( "Skipping {0}", fileName ) ); //return; } SetupBaseHueGoursat(fileName, mirrorsString, baseHue); if (doEdges) { H3.SaveToFile(fileName, edges, finite: true, append: true); } if (doCells) { HashSet <H3.Cell.Edge> cellEdges = new HashSet <H3.Cell.Edge>(new H3.Cell.EdgeEqualityComparer()); foreach (H3.Cell cell in cellsToHighlight) { cell.AppendAllEdges(cellEdges); } edges = cellEdges.ToArray(); H3.SaveToFile(fileName, edges, finite: true, append: true); H3.AppendFacets(fileName, cellsToHighlight); } }
///////////////////////////////////////////////////////// // Hacking around. I should remove this or make CalcCells() configurable enough to deal with more cases. public static H3.Cell[] CalcCells2( Sphere[] mirrors, H3.Cell[] cells ) { Settings settings = new Settings(); return CalcCells2( mirrors, cells, settings ); }
public override string ToString() { return(string.Format("{{{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}}}", H1.ToString("f" + 0), H2.ToString("f" + 9), H3.ToString("f" + 9), H4.ToString("f" + 9), H5.ToString("f" + 9), H6.ToString("f" + 9), H7.ToString("f" + 9), H8.ToString("f" + 9), H9.ToString("f" + 9), H10.ToString("f" + 9))); }
private static bool EdgeOkBall( H3.Cell.Edge edge ) { return EdgeOk( edge, m_params.BallCutoff ); }
private static Dictionary<Vector3D, List<H3.Cell.Edge>> FindConnectedEdges( H3.Cell.Edge[] edges ) { var result = new Dictionary<Vector3D, List<H3.Cell.Edge>>(); System.Action<Vector3D, H3.Cell.Edge> addOne = ( v, e ) => { List<H3.Cell.Edge> edgeList; if( !result.TryGetValue( v, out edgeList ) ) edgeList = new List<H3.Cell.Edge>(); edgeList.Add( e ); result[v] = edgeList; }; foreach( H3.Cell.Edge edge in edges ) { addOne( edge.Start, edge ); addOne( edge.End, edge ); } return result; }
// Use this for initialization void Start() { PlayerIcon.GetComponent <SpriteRenderer>().enabled = true; A1.GetComponent <SpriteRenderer>().enabled = false; A2.GetComponent <SpriteRenderer>().enabled = false; A3.GetComponent <SpriteRenderer>().enabled = false; A4.GetComponent <SpriteRenderer>().enabled = false; A5.GetComponent <SpriteRenderer>().enabled = false; A6.GetComponent <SpriteRenderer>().enabled = false; A7.GetComponent <SpriteRenderer>().enabled = false; A8.GetComponent <SpriteRenderer>().enabled = false; A9.GetComponent <SpriteRenderer>().enabled = false; A10.GetComponent <SpriteRenderer>().enabled = false; A11.GetComponent <SpriteRenderer>().enabled = false; B1.GetComponent <SpriteRenderer>().enabled = false; B2.GetComponent <SpriteRenderer>().enabled = false; B3.GetComponent <SpriteRenderer>().enabled = false; B4.GetComponent <SpriteRenderer>().enabled = false; B5.GetComponent <SpriteRenderer>().enabled = false; B6.GetComponent <SpriteRenderer>().enabled = false; B7.GetComponent <SpriteRenderer>().enabled = false; B8.GetComponent <SpriteRenderer>().enabled = false; B9.GetComponent <SpriteRenderer>().enabled = false; B10.GetComponent <SpriteRenderer>().enabled = false; B11.GetComponent <SpriteRenderer>().enabled = false; C1.GetComponent <SpriteRenderer>().enabled = false; C2.GetComponent <SpriteRenderer>().enabled = false; C3.GetComponent <SpriteRenderer>().enabled = false; C4.GetComponent <SpriteRenderer>().enabled = false; C5.GetComponent <SpriteRenderer>().enabled = false; C6.GetComponent <SpriteRenderer>().enabled = false; C7.GetComponent <SpriteRenderer>().enabled = false; C8.GetComponent <SpriteRenderer>().enabled = false; C9.GetComponent <SpriteRenderer>().enabled = false; C10.GetComponent <SpriteRenderer>().enabled = false; C11.GetComponent <SpriteRenderer>().enabled = false; D1.GetComponent <SpriteRenderer>().enabled = false; D2.GetComponent <SpriteRenderer>().enabled = false; D3.GetComponent <SpriteRenderer>().enabled = false; D4.GetComponent <SpriteRenderer>().enabled = false; D5.GetComponent <SpriteRenderer>().enabled = false; D6.GetComponent <SpriteRenderer>().enabled = false; D7.GetComponent <SpriteRenderer>().enabled = false; D8.GetComponent <SpriteRenderer>().enabled = false; D9.GetComponent <SpriteRenderer>().enabled = false; D10.GetComponent <SpriteRenderer>().enabled = false; D11.GetComponent <SpriteRenderer>().enabled = false; E1.GetComponent <SpriteRenderer>().enabled = false; E2.GetComponent <SpriteRenderer>().enabled = false; E3.GetComponent <SpriteRenderer>().enabled = false; E4.GetComponent <SpriteRenderer>().enabled = false; E5.GetComponent <SpriteRenderer>().enabled = false; E6.GetComponent <SpriteRenderer>().enabled = false; E7.GetComponent <SpriteRenderer>().enabled = false; E8.GetComponent <SpriteRenderer>().enabled = false; E9.GetComponent <SpriteRenderer>().enabled = false; E10.GetComponent <SpriteRenderer>().enabled = false; E11.GetComponent <SpriteRenderer>().enabled = false; F1.GetComponent <SpriteRenderer>().enabled = false; F2.GetComponent <SpriteRenderer>().enabled = false; F3.GetComponent <SpriteRenderer>().enabled = false; F4.GetComponent <SpriteRenderer>().enabled = false; F5.GetComponent <SpriteRenderer>().enabled = false; F6.GetComponent <SpriteRenderer>().enabled = false; F7.GetComponent <SpriteRenderer>().enabled = false; F8.GetComponent <SpriteRenderer>().enabled = false; F9.GetComponent <SpriteRenderer>().enabled = false; F10.GetComponent <SpriteRenderer>().enabled = false; F11.GetComponent <SpriteRenderer>().enabled = false; G1.GetComponent <SpriteRenderer>().enabled = false; G2.GetComponent <SpriteRenderer>().enabled = false; G3.GetComponent <SpriteRenderer>().enabled = false; G4.GetComponent <SpriteRenderer>().enabled = false; G5.GetComponent <SpriteRenderer>().enabled = false; G6.GetComponent <SpriteRenderer>().enabled = false; G7.GetComponent <SpriteRenderer>().enabled = false; G8.GetComponent <SpriteRenderer>().enabled = false; G9.GetComponent <SpriteRenderer>().enabled = false; G10.GetComponent <SpriteRenderer>().enabled = false; G11.GetComponent <SpriteRenderer>().enabled = false; H1.GetComponent <SpriteRenderer>().enabled = false; H2.GetComponent <SpriteRenderer>().enabled = false; H3.GetComponent <SpriteRenderer>().enabled = false; H4.GetComponent <SpriteRenderer>().enabled = false; H5.GetComponent <SpriteRenderer>().enabled = false; H6.GetComponent <SpriteRenderer>().enabled = false; H7.GetComponent <SpriteRenderer>().enabled = false; H8.GetComponent <SpriteRenderer>().enabled = false; H9.GetComponent <SpriteRenderer>().enabled = false; H10.GetComponent <SpriteRenderer>().enabled = false; H11.GetComponent <SpriteRenderer>().enabled = false; I1.GetComponent <SpriteRenderer>().enabled = false; I2.GetComponent <SpriteRenderer>().enabled = false; I3.GetComponent <SpriteRenderer>().enabled = false; I4.GetComponent <SpriteRenderer>().enabled = false; I5.GetComponent <SpriteRenderer>().enabled = false; I6.GetComponent <SpriteRenderer>().enabled = false; I7.GetComponent <SpriteRenderer>().enabled = false; I8.GetComponent <SpriteRenderer>().enabled = false; I9.GetComponent <SpriteRenderer>().enabled = false; I10.GetComponent <SpriteRenderer>().enabled = false; I11.GetComponent <SpriteRenderer>().enabled = false; J1.GetComponent <SpriteRenderer>().enabled = false; J2.GetComponent <SpriteRenderer>().enabled = false; J3.GetComponent <SpriteRenderer>().enabled = false; J4.GetComponent <SpriteRenderer>().enabled = false; J5.GetComponent <SpriteRenderer>().enabled = false; J6.GetComponent <SpriteRenderer>().enabled = false; J7.GetComponent <SpriteRenderer>().enabled = false; J8.GetComponent <SpriteRenderer>().enabled = false; J9.GetComponent <SpriteRenderer>().enabled = false; J10.GetComponent <SpriteRenderer>().enabled = false; J11.GetComponent <SpriteRenderer>().enabled = false; K1.GetComponent <SpriteRenderer>().enabled = false; K2.GetComponent <SpriteRenderer>().enabled = false; K3.GetComponent <SpriteRenderer>().enabled = false; K4.GetComponent <SpriteRenderer>().enabled = false; K5.GetComponent <SpriteRenderer>().enabled = false; K6.GetComponent <SpriteRenderer>().enabled = false; K7.GetComponent <SpriteRenderer>().enabled = false; K8.GetComponent <SpriteRenderer>().enabled = false; K9.GetComponent <SpriteRenderer>().enabled = false; K10.GetComponent <SpriteRenderer>().enabled = false; K11.GetComponent <SpriteRenderer>().enabled = false; float ratio = Screen.width / Screen.height; if (ratio < 2) { int screenx = 543; int screeny = 653; } else { int screenx = 743; int screeny = 853; } }
private static H3.Cell.Edge[] Cull120Cell( H3.Cell.Edge[] edges ) { Func<Vector3D, bool> passes = new Func<Vector3D, bool>( v => { //return // Math.Pow( v.Z, 2 ) < 0.13 && // Math.Pow( v.W, 2 ) < 0.13; return Tolerance.Equal( v.W, 0.0 ); } ); H3.Cell.Edge[] result = edges.Where( e => { Vector3D start = Sterographic.R3toS3( e.Start ); Vector3D end = Sterographic.R3toS3( e.End ); return passes( start ) && passes( end ); } ).ToArray(); // Now cull valence-2 edges. //result = CullValence2Edges( result ); return result; }
/* * HEX( KD ( HEX(H(A1)), * { * nonce-value, ":" nc-value, ":", * cnonce-value, ":", qop-value, ":", HEX(H(A2)) })) * * If authzid is specified, then A1 is * * A1 = { H( { username-value, ":", realm-value, ":", passwd } ), * ":", nonce-value, ":", cnonce-value, ":", authzid-value } * * If authzid is not specified, then A1 is * * A1 = { H( { username-value, ":", realm-value, ":", passwd } ), * ":", nonce-value, ":", cnonce-value } * * where * * passwd = *OCTET */ internal void GenerateResponse() { byte[] H1; byte[] H2; byte[] H3; //byte[] temp; string A1; string A2; string A3; string p1; string p2; var sb = new StringBuilder(); sb.Append(xmppClient.Username); sb.Append(":"); sb.Append(step1.Realm ?? xmppClient.XmppDomain); sb.Append(":"); sb.Append(xmppClient.Password); //H1 = new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(sb.ToString())); H1 = Hash.Md5HashBytes(Encoding.UTF8.GetBytes(sb.ToString())); #if TEST var H1hex = Util.Hash.HexToString(H1); #endif sb.Remove(0, sb.Length); sb.Append(":"); sb.Append(step1.Nonce); sb.Append(":"); sb.Append(Cnonce); if (Authzid != null) { sb.Append(":"); sb.Append(Authzid); } A1 = sb.ToString(); byte[] bA1 = Encoding.ASCII.GetBytes(A1); byte[] bH1A1 = new byte[H1.Length + bA1.Length]; Array.Copy(H1, 0, bH1A1, 0, H1.Length); Array.Copy(bA1, 0, bH1A1, H1.Length, bA1.Length); #if TEST var bH1A1hex = Util.Hash.HexToString(bH1A1); #endif //H1 = new MD5CryptoServiceProvider().ComputeHash(bH1A1); H1 = Hash.Md5HashBytes(bH1A1); #if TEST H1hex = Util.Hash.HexToString(H1); #endif sb.Remove(0, sb.Length); /* * from rfc2831 * If the "qop" directive's value is "auth", then A2 is: * * A2 = { "AUTHENTICATE:", digest-uri-value } * * If the "qop" value is "auth-int" or "auth-conf" then A2 is: * * A2 = { "AUTHENTICATE:", digest-uri-value, * ":00000000000000000000000000000000" } */ sb.Append("AUTHENTICATE:"); sb.Append(DigestUri); if (step1.Qop != "auth") { sb.Append(":00000000000000000000000000000000"); } A2 = sb.ToString(); H2 = Encoding.ASCII.GetBytes(A2); //H2 = new MD5CryptoServiceProvider().ComputeHash(H2); H2 = Hash.Md5HashBytes(H2); #if TEST var H2hex = Util.Hash.HexToString(H2); #endif // create p1 and p2 as the hex representation of H1 and H2 p1 = H1.ToHex(); p2 = H2.ToHex(); sb.Remove(0, sb.Length); sb.Append(p1); sb.Append(":"); sb.Append(step1.Nonce); sb.Append(":"); sb.Append(Nc); sb.Append(":"); sb.Append(Cnonce); sb.Append(":"); sb.Append(step1.Qop); sb.Append(":"); sb.Append(p2); A3 = sb.ToString(); H3 = Hash.Md5HashBytes(Encoding.ASCII.GetBytes(A3)); #if TEST var H3hex = Util.Hash.HexToString(H3); #endif Response = H3.ToHex().ToLower(); }
private static H3.Cell.Edge[] CullValence2Edges( H3.Cell.Edge[] edges ) { List<H3.Cell.Edge> needRemoval = new List<H3.Cell.Edge>(); // Info we'll need to remove dangling edges. Dictionary<Vector3D, int> vertexCounts = new Dictionary<Vector3D, int>(); foreach( H3.Cell.Edge edge in edges ) { CheckAndAdd( vertexCounts, edge.Start ); CheckAndAdd( vertexCounts, edge.End ); } foreach( H3.Cell.Edge e in edges ) { if( vertexCounts[e.Start] == 2 || vertexCounts[e.End] == 2 ) { needRemoval.Add( e ); } } return edges.Except( needRemoval ).ToArray(); }
// Update is called once per frame void FixedUpdate() { posicion = gameObject.GetComponent <Transform>().position; radio2 = gameObject.GetComponent <Colision_pared>().Radio; w1 = H1.GetComponent <T1>().w; mw1 = w1.magnitude; w2 = H2.GetComponent <T2>().w; mw2 = w2.magnitude; w3 = H3.GetComponent <T3>().w; mw3 = w3.magnitude; w4 = H4.GetComponent <T4>().w; mw4 = w4.magnitude; if (encendido == 0) { FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = FN - FD; ac = FT / masa; v.x = 0; v.z = 0; posicion = gameObject.GetComponent <Transform>().position; if ((posicion.y - (radio2 - 5)) <= 0 && (v.y <= 0)) { v.y = -0.3f * v.y; } else { v = v + ac * tiempo; } posicion = posicion + v * tiempo; gameObject.GetComponent <Transform>().position = posicion; } else { if (q) { mw1 = mw2 = mw3 = mw4; b = 0.3f; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.z = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (e) { b = 0.03f; mw1 = mw3 = mw2 + 1; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.z = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (a) { b = 0.03f; mw1 = mw3 + 1; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.y = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (d) { b = 0.03f; mw3 = mw1 + 1; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.y = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (w) { b = 0.03f; mw4 = mw2 + 1; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.y = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (s) { b = 0.03f; mw2 = mw4 + 1; torque.x = L * k * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw3, 2)); torque.z = L * k * (Mathf.Pow(mw2, 2) - Mathf.Pow(mw4, 2)); torque.y = b * (Mathf.Pow(mw1, 2) - Mathf.Pow(mw2, 2) + Mathf.Pow(mw3, 2) - Mathf.Pow(mw4, 2)); FN.y = masa * g; FD.y = 0.5f * (Paire * b * Area * Mathf.Pow(radio, 2)); FT = torque + FN + FD; ac = FT / masa; ac.y = 0; v = v + ac * tiempo; posicion = posicion + v * tiempo; } if (reset) { ac.x = ac.y = ac.z = 0; torque.x = torque.y = torque.z = 0; v.x = v.y = v.z = 0; FN.y = FN.x = FN.z = 0; FD.y = FD.x = FD.z = 0; FT.y = FT.x = FT.z = 0; } } gameObject.GetComponent <Transform>().position = posicion; }
private static bool EdgeOkUHS( H3.Cell.Edge edge, Circle region ) { if( Tolerance.GreaterThan( edge.Start.Abs(), region.Radius ) || Tolerance.GreaterThan( edge.End.Abs(), region.Radius ) ) return false; return EdgeOk( edge, m_params.UhsCutoff ); }
/// <summary> /// Make a povray file for all the edges of a model. /// Works for all geometries (in conformal models, e.g. Ball and Stereographic). /// </summary> public static void WriteEdges( Parameters parameters, Geometry g, H3.Cell.Edge[] edges, string fileName, bool append ) { if( append ) { using( StreamWriter sw = File.AppendText( fileName ) ) { foreach( H3.Cell.Edge edge in edges ) sw.WriteLine( Edge( parameters, g, edge ) ); } } else { using( StreamWriter sw = File.CreateText( fileName ) ) { foreach( H3.Cell.Edge edge in edges ) sw.WriteLine( Edge( parameters, g, edge ) ); } } }
internal static bool CellOk( H3.Cell cell, Settings s ) { if( s.G == Geometry.Spherical ) return true; double thresh = s.Threshold; if( !cell.HasVerts ) { foreach( H3.Cell.Facet f in cell.Facets ) { //bool ball = s.Ball; bool radiusCutoff = true; if( radiusCutoff ) { if( f.Sphere.IsPlane ) continue; //double closestToOrigin = f.Sphere.Center.Abs() - f.Sphere.Radius; //if( closestToOrigin > thresh ) // return false; //if( f.Sphere.Radius < 0.001 ) //if( f.Sphere.Radius < 0.01 ) //if( f.Sphere.Radius < 0.02 ) //if( f.Sphere.Radius < 0.05 ) if( f.Sphere.Radius < 0.1 ) //if( f.Sphere.Radius < 0.25 ) return false; } else { double max = 20; if( f.Sphere.IsPlane ) { if( f.Sphere.Offset.Abs() > max ) return false; } else { if( f.Sphere.Center.Abs() > max ) return false; } } } return true; } // Any vertex < threshold makes us ok. foreach( Vector3D v in cell.Verts ) if( v.Abs() < thresh ) return true; return false; }
/// <summary> /// Make a povray file for all the edges of an H3 model. /// Input edge locations are expected to live in the ball model. /// </summary> public static void WriteH3Edges( Parameters parameters, H3.Cell.Edge[] edges, string fileName, bool append = false ) { WriteEdges( parameters, Geometry.Hyperbolic, edges, fileName, append ); }
private static void ReflectCellsRecursive2( Sphere[] simplex, H3.Cell[] cells, Settings settings, List<H3.Cell> completedCells, HashSet<Vector3D> completedCellIds ) { if( 0 == cells.Length ) return; List<H3.Cell> newCells = new List<H3.Cell>(); foreach( H3.Cell cell in cells ) //foreach( Sphere mirror in simplex ) for( int m = 0; m < simplex.Length; m++ ) { Sphere mirror = simplex[m]; if( completedCellIds.Count > 250000 ) return; H3.Cell newCell = cell.Clone(); newCell.Reflect( mirror ); //if( !CellOk( newCell, settings ) ) bool cellOk = true; foreach( H3.Cell.Facet f in cell.Facets ) if( f.Sphere.Radius < 0.002 ) cellOk = false; if( !cellOk ) continue; // This tracks reflections across the cell facets. newCell.Depths[m]++; if( completedCellIds.Add( newCell.ID ) ) { // Haven't seen this cell yet, so // we'll need to recurse on it. newCells.Add( newCell ); completedCells.Add( newCell ); } } ReflectCellsRecursive2( simplex, newCells.ToArray(), settings, completedCells, completedCellIds ); }
private static string Edge( Parameters parameters, Geometry g, H3.Cell.Edge edge ) { Vector3D v1 = edge.Start, v2 = edge.End; Vector3D[] points = null; Func<Vector3D, Sphere> sizeFunc = v => new Sphere() { Center = v, Radius = H3Models.SizeFuncConst( v, parameters.Scale ) }; //double minRad = 0.0005; double minRad = 0.0000; //double minRad = 0.0017; if( parameters.Halfspace ) { //v1 = H3Models.BallToUHS( v1 ); //v2 = H3Models.BallToUHS( v2 ); points = H3Models.UHS.GeodesicPoints( v1, v2 ); if( !parameters.ThinEdges ) sizeFunc = v => { // XXX, inexact return new Sphere() { Center = v, Radius = Math.Max( H3Models.UHS.SizeFunc( v, parameters.AngularThickness ), minRad ) }; }; } else { if( g == Geometry.Hyperbolic ) points = H3Models.Ball.GeodesicPoints( v1, v2, edge.Color.Z ); else if( g == Geometry.Spherical ) { points = S3.GeodesicPoints( v1, v2 ); //points = points.Select( p => { p.Normalize(); return p; } ).ToArray(); } else { //points = new Vector3D[] { v1, v2 }; List<Vector3D> interpolated = new List<Vector3D>(); int count = 20; for( int i = 0; i <= count; i++ ) interpolated.Add( v1 + ( v2 - v1 ) * ( (double)i / count ) ); points = interpolated.ToArray(); } if( !parameters.ThinEdges ) sizeFunc = v => { Vector3D c; double r; H3Models.Ball.DupinCyclideSphere( v, parameters.AngularThickness/2, g, out c, out r ); return new Sphere() { Center = c, Radius = Math.Max( r, minRad ) }; //return new Sphere() { Center = v, Radius = H3Models.Ball.SizeFunc( v, parameters.AngularThickness ) }; // inexact }; } //if( g == Geometry.Euclidean ) // return EdgeCylinder( points, sizeFunc ); return EdgeSphereSweep( points, sizeFunc, edge.Color ); }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.h31 = new ComboCounter.Classes.H3(); this.h32 = new ComboCounter.Classes.H3(); this.h33 = new ComboCounter.Classes.H3(); this.compPound = new ComboCounter.CustomControls.OutlineButton(); this.sensorAdj = new ComboCounter.CustomControls.OutlineButton(); this.punchCountDefault = new ComboCounter.CustomControls.OutlineButton(); this.punchCountCustom = new ComboCounter.CustomControls.OutlineButton(); this.punchChallengeDefault = new ComboCounter.CustomControls.OutlineButton(); this.punchChallengeCustom = new ComboCounter.CustomControls.OutlineButton(); this.h35 = new ComboCounter.Classes.H3(); this.h36 = new ComboCounter.Classes.H3(); this.h34 = new ComboCounter.Classes.H3(); this.comboCountCustom = new ComboCounter.CustomControls.OutlineButton(); this.totalForce2Play = new ComboCounter.CustomControls.OutlineButton(); this.totalTimeCustom = new ComboCounter.CustomControls.OutlineButton(); this.totalTimeDefault = new ComboCounter.CustomControls.OutlineButton(); this.totalForceDefault = new ComboCounter.CustomControls.OutlineButton(); this.comboCounterDefault = new ComboCounter.CustomControls.OutlineButton(); this.ghostPanel = new System.Windows.Forms.Panel(); this.ghostPanel2 = new System.Windows.Forms.Panel(); this.clockPanel = new System.Windows.Forms.Panel(); this.date = new ComboCounter.Classes.SmallInfo(); this.clockText = new ComboCounter.Classes.SmallInfo(); this.timer = new System.Windows.Forms.Timer(this.components); this.tableLayoutPanel1.SuspendLayout(); this.clockPanel.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.31247F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.21601F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.47152F)); this.tableLayoutPanel1.Controls.Add(this.h31, 0, 1); this.tableLayoutPanel1.Controls.Add(this.h32, 1, 1); this.tableLayoutPanel1.Controls.Add(this.h33, 2, 1); this.tableLayoutPanel1.Controls.Add(this.compPound, 0, 5); this.tableLayoutPanel1.Controls.Add(this.sensorAdj, 0, 6); this.tableLayoutPanel1.Controls.Add(this.punchCountDefault, 1, 5); this.tableLayoutPanel1.Controls.Add(this.punchCountCustom, 1, 6); this.tableLayoutPanel1.Controls.Add(this.punchChallengeDefault, 2, 5); this.tableLayoutPanel1.Controls.Add(this.punchChallengeCustom, 2, 6); this.tableLayoutPanel1.Controls.Add(this.h35, 1, 4); this.tableLayoutPanel1.Controls.Add(this.h36, 2, 4); this.tableLayoutPanel1.Controls.Add(this.h34, 0, 4); this.tableLayoutPanel1.Controls.Add(this.comboCountCustom, 0, 3); this.tableLayoutPanel1.Controls.Add(this.totalForce2Play, 1, 3); this.tableLayoutPanel1.Controls.Add(this.totalTimeCustom, 2, 3); this.tableLayoutPanel1.Controls.Add(this.totalTimeDefault, 2, 2); this.tableLayoutPanel1.Controls.Add(this.totalForceDefault, 1, 2); this.tableLayoutPanel1.Controls.Add(this.comboCounterDefault, 0, 2); this.tableLayoutPanel1.Controls.Add(this.ghostPanel, 1, 0); this.tableLayoutPanel1.Controls.Add(this.ghostPanel2, 0, 0); this.tableLayoutPanel1.Controls.Add(this.clockPanel, 2, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(40); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 7; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.81056F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.44776F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.12615F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.00919F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.15943F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.15943F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.15943F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1565, 871); this.tableLayoutPanel1.TabIndex = 0; // // h31 // this.h31.AutoSize = true; this.h31.Dock = System.Windows.Forms.DockStyle.Fill; this.h31.ForeColor = System.Drawing.Color.SteelBlue; this.h31.Location = new System.Drawing.Point(3, 129); this.h31.Name = "h31"; this.h31.Size = new System.Drawing.Size(515, 91); this.h31.TabIndex = 2; this.h31.Text = "Combo Counter"; this.h31.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // h32 // this.h32.AutoSize = true; this.h32.Dock = System.Windows.Forms.DockStyle.Fill; this.h32.ForeColor = System.Drawing.Color.SteelBlue; this.h32.ImageAlign = System.Drawing.ContentAlignment.TopRight; this.h32.Location = new System.Drawing.Point(524, 129); this.h32.Name = "h32"; this.h32.Size = new System.Drawing.Size(513, 91); this.h32.TabIndex = 3; this.h32.Text = "Total Force"; this.h32.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // h33 // this.h33.AutoSize = true; this.h33.Dock = System.Windows.Forms.DockStyle.Fill; this.h33.ForeColor = System.Drawing.Color.SteelBlue; this.h33.Location = new System.Drawing.Point(1043, 129); this.h33.Name = "h33"; this.h33.Size = new System.Drawing.Size(519, 91); this.h33.TabIndex = 5; this.h33.Text = "Total Time"; this.h33.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // compPound // this.compPound.Anchor = System.Windows.Forms.AnchorStyles.None; this.compPound.AutoSize = true; this.compPound.BackColor = System.Drawing.Color.Transparent; this.compPound.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.compPound.FlatAppearance.BorderSize = 2; this.compPound.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.compPound.Location = new System.Drawing.Point(64, 638); this.compPound.Name = "compPound"; this.compPound.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.compPound.Size = new System.Drawing.Size(393, 65); this.compPound.TabIndex = 8; this.compPound.Text = "POUND-FOR-POUND"; this.compPound.UseVisualStyleBackColor = false; this.compPound.Click += new System.EventHandler(this.compPound_Click); // // sensorAdj // this.sensorAdj.Anchor = System.Windows.Forms.AnchorStyles.None; this.sensorAdj.AutoSize = true; this.sensorAdj.BackColor = System.Drawing.Color.Transparent; this.sensorAdj.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.sensorAdj.FlatAppearance.BorderSize = 2; this.sensorAdj.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.sensorAdj.Location = new System.Drawing.Point(42, 771); this.sensorAdj.Name = "sensorAdj"; this.sensorAdj.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.sensorAdj.Size = new System.Drawing.Size(436, 65); this.sensorAdj.TabIndex = 9; this.sensorAdj.Text = "SENSOR ADJUSTMENT"; this.sensorAdj.UseVisualStyleBackColor = false; this.sensorAdj.Click += new System.EventHandler(this.sensorAdj_Click); // // punchCountDefault // this.punchCountDefault.Anchor = System.Windows.Forms.AnchorStyles.None; this.punchCountDefault.AutoSize = true; this.punchCountDefault.BackColor = System.Drawing.Color.Transparent; this.punchCountDefault.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.punchCountDefault.FlatAppearance.BorderSize = 2; this.punchCountDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.punchCountDefault.Location = new System.Drawing.Point(676, 638); this.punchCountDefault.Name = "punchCountDefault"; this.punchCountDefault.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.punchCountDefault.Size = new System.Drawing.Size(208, 65); this.punchCountDefault.TabIndex = 10; this.punchCountDefault.Text = "Default"; this.punchCountDefault.UseVisualStyleBackColor = false; this.punchCountDefault.Click += new System.EventHandler(this.punchCountDefault_Click); // // punchCountCustom // this.punchCountCustom.Anchor = System.Windows.Forms.AnchorStyles.None; this.punchCountCustom.AutoSize = true; this.punchCountCustom.BackColor = System.Drawing.Color.Transparent; this.punchCountCustom.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.punchCountCustom.FlatAppearance.BorderSize = 2; this.punchCountCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.punchCountCustom.Location = new System.Drawing.Point(681, 771); this.punchCountCustom.Name = "punchCountCustom"; this.punchCountCustom.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.punchCountCustom.Size = new System.Drawing.Size(199, 65); this.punchCountCustom.TabIndex = 11; this.punchCountCustom.Text = "2 Players"; this.punchCountCustom.UseVisualStyleBackColor = false; this.punchCountCustom.Click += new System.EventHandler(this.punchCountCustom_Click); // // punchChallengeDefault // this.punchChallengeDefault.Anchor = System.Windows.Forms.AnchorStyles.None; this.punchChallengeDefault.AutoSize = true; this.punchChallengeDefault.BackColor = System.Drawing.Color.Transparent; this.punchChallengeDefault.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.punchChallengeDefault.FlatAppearance.BorderSize = 2; this.punchChallengeDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.punchChallengeDefault.Location = new System.Drawing.Point(1198, 638); this.punchChallengeDefault.Name = "punchChallengeDefault"; this.punchChallengeDefault.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.punchChallengeDefault.Size = new System.Drawing.Size(208, 65); this.punchChallengeDefault.TabIndex = 15; this.punchChallengeDefault.Text = "Default"; this.punchChallengeDefault.UseVisualStyleBackColor = false; this.punchChallengeDefault.Click += new System.EventHandler(this.punchChallengeDefault_Click); // // punchChallengeCustom // this.punchChallengeCustom.Anchor = System.Windows.Forms.AnchorStyles.None; this.punchChallengeCustom.AutoSize = true; this.punchChallengeCustom.BackColor = System.Drawing.Color.Transparent; this.punchChallengeCustom.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.punchChallengeCustom.FlatAppearance.BorderSize = 2; this.punchChallengeCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.punchChallengeCustom.Location = new System.Drawing.Point(1203, 771); this.punchChallengeCustom.Name = "punchChallengeCustom"; this.punchChallengeCustom.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.punchChallengeCustom.Size = new System.Drawing.Size(199, 65); this.punchChallengeCustom.TabIndex = 16; this.punchChallengeCustom.Text = "2 Players"; this.punchChallengeCustom.UseVisualStyleBackColor = false; this.punchChallengeCustom.Click += new System.EventHandler(this.punchChallengeCustom_Click); // // h35 // this.h35.AutoSize = true; this.h35.Dock = System.Windows.Forms.DockStyle.Fill; this.h35.ForeColor = System.Drawing.Color.SteelBlue; this.h35.Location = new System.Drawing.Point(524, 473); this.h35.Name = "h35"; this.h35.Size = new System.Drawing.Size(513, 132); this.h35.TabIndex = 18; this.h35.Text = "Punch Count"; this.h35.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // h36 // this.h36.AutoSize = true; this.h36.Dock = System.Windows.Forms.DockStyle.Fill; this.h36.ForeColor = System.Drawing.Color.SteelBlue; this.h36.Location = new System.Drawing.Point(1043, 473); this.h36.Name = "h36"; this.h36.Size = new System.Drawing.Size(519, 132); this.h36.TabIndex = 19; this.h36.Text = "Punch Challenge"; this.h36.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // h34 // this.h34.AutoSize = true; this.h34.Dock = System.Windows.Forms.DockStyle.Fill; this.h34.ForeColor = System.Drawing.Color.SteelBlue; this.h34.Location = new System.Drawing.Point(3, 473); this.h34.Name = "h34"; this.h34.Size = new System.Drawing.Size(515, 132); this.h34.TabIndex = 17; this.h34.Text = "Competition"; this.h34.TextAlign = System.Drawing.ContentAlignment.BottomCenter; // // comboCountCustom // this.comboCountCustom.Anchor = System.Windows.Forms.AnchorStyles.None; this.comboCountCustom.AutoSize = true; this.comboCountCustom.BackColor = System.Drawing.Color.Transparent; this.comboCountCustom.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.comboCountCustom.FlatAppearance.BorderSize = 2; this.comboCountCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.comboCountCustom.Location = new System.Drawing.Point(161, 388); this.comboCountCustom.Name = "comboCountCustom"; this.comboCountCustom.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.comboCountCustom.Size = new System.Drawing.Size(199, 65); this.comboCountCustom.TabIndex = 7; this.comboCountCustom.Text = "Custom"; this.comboCountCustom.UseVisualStyleBackColor = false; this.comboCountCustom.Click += new System.EventHandler(this.comboCountCustom_Click); // // totalForce2Play // this.totalForce2Play.Anchor = System.Windows.Forms.AnchorStyles.None; this.totalForce2Play.AutoSize = true; this.totalForce2Play.BackColor = System.Drawing.Color.Transparent; this.totalForce2Play.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.totalForce2Play.FlatAppearance.BorderSize = 2; this.totalForce2Play.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.totalForce2Play.Location = new System.Drawing.Point(662, 388); this.totalForce2Play.Name = "totalForce2Play"; this.totalForce2Play.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.totalForce2Play.Size = new System.Drawing.Size(237, 65); this.totalForce2Play.TabIndex = 14; this.totalForce2Play.Text = "2 Players"; this.totalForce2Play.UseVisualStyleBackColor = false; this.totalForce2Play.Click += new System.EventHandler(this.totalForce2Play_Click); // // totalTimeCustom // this.totalTimeCustom.Anchor = System.Windows.Forms.AnchorStyles.None; this.totalTimeCustom.AutoSize = true; this.totalTimeCustom.BackColor = System.Drawing.Color.Transparent; this.totalTimeCustom.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.totalTimeCustom.FlatAppearance.BorderSize = 2; this.totalTimeCustom.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.totalTimeCustom.Location = new System.Drawing.Point(1203, 388); this.totalTimeCustom.Name = "totalTimeCustom"; this.totalTimeCustom.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.totalTimeCustom.Size = new System.Drawing.Size(199, 65); this.totalTimeCustom.TabIndex = 13; this.totalTimeCustom.Text = "2 Players"; this.totalTimeCustom.UseVisualStyleBackColor = false; this.totalTimeCustom.Click += new System.EventHandler(this.totalTimeCustom_Click); // // totalTimeDefault // this.totalTimeDefault.Anchor = System.Windows.Forms.AnchorStyles.None; this.totalTimeDefault.AutoSize = true; this.totalTimeDefault.BackColor = System.Drawing.Color.Transparent; this.totalTimeDefault.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.totalTimeDefault.FlatAppearance.BorderSize = 2; this.totalTimeDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.totalTimeDefault.Location = new System.Drawing.Point(1198, 262); this.totalTimeDefault.Name = "totalTimeDefault"; this.totalTimeDefault.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.totalTimeDefault.Size = new System.Drawing.Size(208, 65); this.totalTimeDefault.TabIndex = 6; this.totalTimeDefault.Text = "Default"; this.totalTimeDefault.UseVisualStyleBackColor = false; this.totalTimeDefault.Click += new System.EventHandler(this.totalTimeDefault_Click); // // totalForceDefault // this.totalForceDefault.Anchor = System.Windows.Forms.AnchorStyles.None; this.totalForceDefault.AutoSize = true; this.totalForceDefault.BackColor = System.Drawing.Color.Transparent; this.totalForceDefault.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.totalForceDefault.FlatAppearance.BorderSize = 2; this.totalForceDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.totalForceDefault.Location = new System.Drawing.Point(676, 262); this.totalForceDefault.Name = "totalForceDefault"; this.totalForceDefault.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.totalForceDefault.Size = new System.Drawing.Size(208, 65); this.totalForceDefault.TabIndex = 4; this.totalForceDefault.Text = "Default"; this.totalForceDefault.UseVisualStyleBackColor = false; this.totalForceDefault.Click += new System.EventHandler(this.totalForceDefault_Click); // // comboCounterDefault // this.comboCounterDefault.Anchor = System.Windows.Forms.AnchorStyles.None; this.comboCounterDefault.AutoSize = true; this.comboCounterDefault.BackColor = System.Drawing.Color.Transparent; this.comboCounterDefault.FlatAppearance.BorderColor = System.Drawing.Color.SteelBlue; this.comboCounterDefault.FlatAppearance.BorderSize = 2; this.comboCounterDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.comboCounterDefault.Location = new System.Drawing.Point(156, 262); this.comboCounterDefault.Name = "comboCounterDefault"; this.comboCounterDefault.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.comboCounterDefault.Size = new System.Drawing.Size(208, 65); this.comboCounterDefault.TabIndex = 1; this.comboCounterDefault.Text = "Default"; this.comboCounterDefault.UseVisualStyleBackColor = false; this.comboCounterDefault.Click += new System.EventHandler(this.comboCounterDefault_Click); // // ghostPanel // this.ghostPanel.Anchor = System.Windows.Forms.AnchorStyles.None; this.ghostPanel.Location = new System.Drawing.Point(524, 4); this.ghostPanel.Name = "ghostPanel"; this.ghostPanel.Size = new System.Drawing.Size(513, 120); this.ghostPanel.TabIndex = 20; // // ghostPanel2 // this.ghostPanel2.Location = new System.Drawing.Point(3, 3); this.ghostPanel2.Name = "ghostPanel2"; this.ghostPanel2.Size = new System.Drawing.Size(515, 100); this.ghostPanel2.TabIndex = 21; // // clockPanel // this.clockPanel.Controls.Add(this.date); this.clockPanel.Controls.Add(this.clockText); this.clockPanel.Location = new System.Drawing.Point(1043, 3); this.clockPanel.Name = "clockPanel"; this.clockPanel.Size = new System.Drawing.Size(519, 123); this.clockPanel.TabIndex = 22; // // date // this.date.AutoSize = true; this.date.Location = new System.Drawing.Point(146, 68); this.date.Name = "date"; this.date.Size = new System.Drawing.Size(0, 61); this.date.TabIndex = 2; // // clockText // this.clockText.AutoSize = true; this.clockText.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.clockText.Location = new System.Drawing.Point(190, 23); this.clockText.Name = "clockText"; this.clockText.Size = new System.Drawing.Size(0, 61); this.clockText.TabIndex = 1; this.clockText.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // timer // this.timer.Enabled = true; this.timer.Interval = 1000; this.timer.Tick += new System.EventHandler(this.timer_Tick); // // HomeScreen // this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.tableLayoutPanel1); this.Name = "HomeScreen"; this.Size = new System.Drawing.Size(1565, 871); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.clockPanel.ResumeLayout(false); this.clockPanel.PerformLayout(); this.ResumeLayout(false); }
private static bool EdgeOk( H3.Cell.Edge edge, double cutoff ) { return edge.Start.Dist( edge.End ) > cutoff; }