getChainStartIndices method

List<int> getChainStartIndices(
  1. List<Coordinate> pts
)

Implementation

List<int> getChainStartIndices(List<Coordinate> pts) {
  // find the startpoint (and endpoints) of all monotone chains in this edge
  int start = 0;
  List<int> startIndexList = []; //List(pts.length ~/ 2, );
  // use heuristic to size initial array
  //startIndexList.ensureCapacity(pts.length / 4);
  startIndexList.add(start);
  do {
    int last = findChainEnd(pts, start);
    startIndexList.add(last);
    start = last;
  } while (start < pts.length - 1);
  // copy list to an array of ints, for efficiency
  return startIndexList;
}