public PoleDot(int x, int y) { position_x = x; position_y = y; up = null; down = null; right = null; left = null; isUsed = false; }
public void AddLine(PoleLine newLine, PoleDot anotherDot) { if (position_x < anotherDot.position_x) { right = newLine; } else if (position_x > anotherDot.position_x) { left = newLine; } else if (position_y < anotherDot.position_y) { down = newLine; } else if (position_y > anotherDot.position_y) { up = newLine; } }
public Pole(int size, int seed) { path = new PolePath(); myRandGen = new MyRandom(seed); poleSize = size; eltsManager = new PoleElts(); poleDots = new PoleDot[size][]; poleLines = new List <PoleLine>(); for (int y = 0; y < size; y++) { poleDots[y] = new PoleDot[size]; for (int x = 0; x < size; x++) { poleDots[y][x] = new PoleDot(x, y); } } for (int y = 0; y < size; y++) { for (int x = 0; x < size - 1; x++) { PoleLine line = new PoleLine(poleDots[y][x], poleDots[y][x + 1]); poleDots[y][x].AddLine(line, poleDots[y][x + 1]); poleDots[y][x + 1].AddLine(line, poleDots[y][x]); poleLines.Add(line); } if (y < size - 1) { for (int x = 0; x < size; x++) { PoleLine line = new PoleLine(poleDots[y][x], poleDots[y + 1][x]); poleDots[y][x].AddLine(line, poleDots[y + 1][x]); poleDots[y + 1][x].AddLine(line, poleDots[y][x]); poleLines.Add(line); } } } }
public PoleEltPoint(PoleLine line) { attachedLine = line; }