public TriangularLattice(BaseGrid grid, Orientation orientation, LatticeTypeEnum latticeType, bool alt) { init(grid, orientation, latticeType); double z = Math.Floor(_lineCount / 2); //TODO: Swap out the "xPos and yPos variables + while loops" with "cell limit per row + for loop" double yPos = (_lineCount * Hex.UnitHeight / 2); double xPos = -grid.OriginX + ((Hex.UnitWidth / 2) * Math.Abs(z % 2)); while (yPos >= (-grid.OriginY)) { double x = calculateBaseXCoordinate(z); double y = -x - z; while (xPos <= (grid.OriginX)) { var labelText = siteId + ": " + x + ", " + y + ", " + z; var hexLocation = new HexCoord(x, y, z); var location = hexLocation.ToCartesian(); //var location2 = orientation == Orientation.Horizontal ? new CartesianCoord(xPos, yPos) : new CartesianCoord(yPos, xPos); //if (siteId == 25 || siteId == 7) //{ //} //Console.WriteLine(labelText + " [" + xPos + "<" + grid.OriginX + "]"); createNewSite(latticeType, x, y, z, labelText, location); xPos += Hex.UnitWidth; //if (xPos > grid.OriginX) //Console.WriteLine(xPos + ">" + grid.OriginX + "----"); x++; y--; } xPos = (-grid.OriginX) + ((Hex.UnitWidth / 2) * Math.Abs((1 + z) % 2)); yPos -= Hex.UnitHeight; z--; } }