code: function linkedList (data, start, end, dim, clockwise) {
    var sum = 0,
      i, j, last
  
    // calculate original winding order of a polygon ring
    for (i = start, j = end - dim; i < end; i += dim) {
      sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1])
      j = i
    }
  
    // link points into circular doubly-linked list in the specified winding order
    if (clockwise === (sum > 0)) {
      for (i = start; i < end; i += dim) {
        last = insertNode(i, last)
      }
    } else {
      for (i = end - dim; i >= start; i -= dim) {
        last = insertNode(i, last)
      }
    }
  
    return last
  }
docs: create a circular doubly linked list from polygon points in the specified winding order