getChainsWithContext static method

List getChainsWithContext(
  1. List<Coordinate> pts,
  2. Object? context
)

Computes a list of the {@link MonotoneChain}s for a list of coordinates, attaching a context data object to each.

@param pts the list of points to compute chains for @param context a data object to attach to each chain @return a list of the monotone chains for the points

Implementation

static List getChainsWithContext(List<Coordinate> pts, Object? context) {
  List mcList = [];
  int chainStart = 0;
  do {
    int chainEnd = findChainEnd(pts, chainStart);
    MonotoneChainI mc =
        new MonotoneChainI(pts, chainStart, chainEnd, context);
    mcList.add(mc);
    chainStart = chainEnd;
  } while (chainStart < pts.length - 1);
  return mcList;
}