getNodes method

void getNodes(
  1. VoronoiDiagramCallback callback
)

Implementation

void getNodes(VoronoiDiagramCallback callback) {
  for (int y = 0; y < _countY - 1; y++) {
    for (int x = 0; x < _countX - 1; x++) {
      int i = x + y * _countX;
      VoronoiGenerator a = _diagram[i];
      VoronoiGenerator b = _diagram[i + 1];
      VoronoiGenerator c = _diagram[i + _countX];
      VoronoiGenerator d = _diagram[i + 1 + _countX];
      if (b != c) {
        if (a != b && a != c) {
          callback.callback(a.tag, b.tag, c.tag);
        }
        if (d != b && d != c) {
          callback.callback(b.tag, d.tag, c.tag);
        }
      }
    }
  }
}