function withoutRedundantPoints(waypoints) {
  return waypoints.reduce(function(points, p, idx) {

    var previous = points[points.length - 1],
        next = waypoints[idx + 1];

    if (!pointsOnLine(previous, next, p, 0)) {
      points.push(p);
    }

    return points;
  }, []);
}
Return list of waypoints with redundant ones filtered out.

@example

Original points:

  [x] ----- [x] ------ [x]
                        |
                       [x] ----- [x] - [x]

Filtered:

  [x] ---------------- [x]
                        |
                       [x] ----------- [x]

@param {Point[]} waypoints

@return {Point[]}