filterPoints function

dynamic filterPoints(
  1. dynamic start,
  2. dynamic end
)

Implementation

filterPoints(start, end) {
  if (start == null) return start;
  end ??= start;

  var p = start, again;
  do {
    again = false;

    if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) == 0)) {
      removeNode(p);
      p = end = p.prev;
      if (p == p.next) break;
      again = true;
    } else {
      p = p.next;
    }
  } while (again || p != end);

  return end;
}