processAllPoints method

void processAllPoints()

Iterates over all the points in order of increasing distance from the seed triangle's circumcenter, adding them to the triangulation.

After this call, the getters triangles, halfEdges, and hull will have meaningful contents.

Implementation

void processAllPoints() {
  final int n = _coords.length >> 1;
  if (n < 3 || _colinear) {
    return;
  }
  double xp = 0.0, yp = 0.0;
  for (int i = 0; i < n; i++) {
    final int idx = _ids[i];
    final double x = _coords[2 * idx];
    final double y = _coords[2 * idx + 1];

    if (i > 0 && (x - xp).abs() <= _epsilon && (y - yp).abs() <= _epsilon) {
      // Too close to the previous point. Skip it.
      continue;
    }
    xp = x;
    yp = y;

    // Skip seed triangle points.
    if (idx == _i0 || idx == _i1 || idx == _i2) {
      continue;
    }

    _hullSize = _processNextPoint(_hullSize, idx, x, y);
  }

  _hull = Uint32List(_hullSize);
  int e = _hullStart;
  for (int i = 0; i < _hullSize; i++) {
    _hull[i] = e;
    e = _hullNext[e];
  }
}