int QuickHullPartition(List <CGPoint> points, int low, int high) { int fp = CGUtils.LeftFarmostPointFromLine(points[low], points[high], points); if (fp == -1) { return(-1); } CGPoint from = points[low]; low++; high--; points.Swap(low, fp); CGPoint pivot = points[low]; while (low < high) { while (low < high && !CGUtils.ToLeft(from, pivot, points[high])) { high--; } points[low] = points[high]; while (low < high && CGUtils.ToLeft(from, pivot, points[high])) { low++; } points[high] = points[low]; } points[low] = pivot; return(low); }