private void assignNeigbors(YaoNode node, int x, int y, int z) { Triple start = new Triple(x, y, z); for (int xDir = -1; xDir <= 1; xDir++) { for (int yDir = -1; yDir <= 1; yDir++) { for (int zDir = -1; zDir <= 1; zDir++) { EdgeDir direction = xyzToDir(xDir, yDir, zDir); if (edgeset.Contains(direction)) // does the edgeset of the current connection type contain this edge? { Triple dir = new Triple(xDir, yDir, zDir); bool success = false; Triple neighbor = getNeighbor(start, dir, data, ref success); if (success) { Assert.IsTrue(checkIdx(neighbor.x, xdim) && checkIdx(neighbor.y, ydim) && checkIdx(neighbor.z, zdim)); int edgeIdx = edgeDirToIdx(direction); Assert.IsTrue(edgeIdx >= 0 && edgeIdx < edgeset.Count); node.setEdge(edgeIdx, data[neighbor.x, neighbor.y, neighbor.z]); //Debug.Log("Neighbor found " + neighbor + " in dir " + direction); } else { //Debug.Log("Neighbor not found"); } } } } } }
public Edge AddEdge(Point start, Point end, EdgeDir edgeDir = EdgeDir.Dual) { Edge edge = new Edge(start, end, edgeDir); m_edges.Add(edge); onAddElement(edge); return(edge); }
internal SnapEdge(UnityEngine.Object win, EdgeDir _d, float _p, float _s, float _e) { this.dir = _d; this.m_Object = win; this.pos = _p; this.start = _s; this.end = _e; }
public void ChangeDir() { int value = (int)m_dir; int count = (int)EdgeDir.Count; value = value + 1 == count ? 0 : value + 1; m_dir = (EdgeDir)value; }
internal static EdgeDir OppositeEdge(EdgeDir dir) { switch (dir) { case EdgeDir.Left: return EdgeDir.Right; case EdgeDir.Right: return EdgeDir.Left; case EdgeDir.CenterX: return EdgeDir.CenterX; case EdgeDir.Up: return EdgeDir.Down; case EdgeDir.Down: return EdgeDir.Up; } return EdgeDir.CenterY; }
internal static EdgeDir OppositeEdge(EdgeDir dir) { switch (dir) { case EdgeDir.Left: return(EdgeDir.Right); case EdgeDir.Right: return(EdgeDir.Left); case EdgeDir.CenterX: return(EdgeDir.CenterX); case EdgeDir.Up: return(EdgeDir.Down); case EdgeDir.Down: return(EdgeDir.Up); } return(EdgeDir.CenterY); }
public Edge(Point start, Point end, EdgeDir dir = EdgeDir.Dual) { m_start = start; m_end = end; m_dir = dir; }
private int edgeDirToIdx(EdgeDir dir) { Assert.IsTrue(edgeset.Contains(dir)); return(edgeset.IndexOf(dir)); }
/// <summary> /// Gets the hexagon edge that is in the specified direction. /// </summary> public HexEdge GetEdge(EdgeDir direction) { return GetEdges()[(int)direction]; }