code: function filterPoints (data, start, end) {
    if (!end) {
      end = start
    }
  
    var node = start,
      again
    do {
      again = false
  
      if (!node.steiner && (equals(data, node.i, node.next.i) || orient(data, node.prev.i, node.i, node.next.i) === 0)) {
  
        // remove node
        node.prev.next = node.next
        node.next.prev = node.prev
  
        if (node.prevZ) {
          node.prevZ.nextZ = node.nextZ
        }
        if (node.nextZ) {
          node.nextZ.prevZ = node.prevZ
        }
  
        node = end = node.prev
  
        if (node === node.next) {
          return null
        }
        again = true
  
      } else {
        node = node.next
      }
    } while (again || node !== end)
  
    return end
  }
docs: eliminate colinear or duplicate points