code: function (points, intersections, iMap, polygons, iMaps) {
                  var poleIndex = -1;
                  for (var i = 0; i < intersections.length - 1; i += 2) {
                      var i0 = intersections[i];
                      var i1 = intersections[i + 1];
  
                      var start = i0.indexStart;
                      var end = i1.indexEnd;
                      var polygon = [];
                      var polygonHashMap = new HashMap();
                      var containsPole = this.makePolygon(start, end, points, iMap, polygon, polygonHashMap);
                      if (polygon.length) {
                          polygons.push(polygon);
                          iMaps.push(polygonHashMap);
                          if (containsPole) {
                              poleIndex = polygons.length - 1;
                          }
                      }
  
                      start = i1.indexStart;
                      end = i0.indexEnd;
                      polygon = [];
                      polygonHashMap = new HashMap();
                      containsPole = this.makePolygon(start, end, points, iMap, polygon, polygonHashMap);
                      if (polygon.length) {
                          polygons.push(polygon);
                          iMaps.push(polygonHashMap);
                          if (containsPole) {
                              poleIndex = polygons.length - 1;
                          }
                      }
                  }
  
                  return poleIndex;
              }
docs: Internal. Applications should not call this method.
  @param {Location[] | Position[]} points
  @param {Array} intersections
  @param {HashMap} iMap
  @param {Array} polygons an empty array to store the resulting polygons
  @param {HashMap[]} iMaps an empty array to store the resulting hasp maps for each polygon
  @returns {Number} the pole number @see Location.poles