/// <summary> /// Setup a circle we'll use to color neighbors. /// </summary> private void SetupNeighborCircle(Tile templateTriangle) { Polygon poly = m_tiles.First().Boundary; // Tetrahedral tiling. CircleNE circ = new CircleNE(); circ.Radius = m_shrink; circ.Reflect(poly.Segments[2]); circ.Reflect(templateTriangle.Boundary.Segments[1]); Mobius m = new Mobius(); m.Isometry(Geometry.Spherical, 0, -circ.CenterNE); circ.Transform(m); m_neighborCircle = new CircleNE(); m_neighborCircle.Radius = 1.0 / circ.Radius; m_originalNeighborCircle = m_neighborCircle.Clone(); System.Func <Vector3D, Vector3D> pointTransform = v => { v *= m_neighborCircle.Radius; v = new Vector3D(v.Y, v.X); v.RotateXY(-Math.PI / 2); return(v); }; m_neighborToStandardDisk = CalcMobius(pointTransform); }
/// <summary> /// This will return whether we'll be a new tile after reflecting through a segment. /// This allows us to do the check without having to do all the work of reflecting the entire tile. /// </summary> public bool NewTileAfterReflect(Tile t, Segment s, Dictionary <Vector3D, bool> completed) { /* This was too slow! * Polygon newPolyBoundary = t.Boundary.Clone(); * newPolyBoundary.Reflect( s ); * Vector3D testCenter = this.TilingConfig.M.Apply( newPolyBoundary.Center );*/ CircleNE newVertexCircle = t.VertexCircle.Clone(); newVertexCircle.Reflect(s); Vector3D testCenter = this.TilingConfig.M.Apply(newVertexCircle.CenterNE); return(!completed.ContainsKey(testCenter)); }
private bool NewTetAfterReflect(Cell cell, Segment s, HashSet <Vector3D> completed) { foreach (Tile tile in cell.Tiles) { CircleNE newVertexCircle = tile.VertexCircle.Clone(); newVertexCircle.Reflect(s); if (completed.Contains(Infinity.InfinitySafe(newVertexCircle.CenterNE))) { return(false); } } return(true); }