irisCenterFromPoints function
Returns the iris point closest to the centroid.
Implementation
Point irisCenterFromPoints(List<Point> pts) {
if (pts.isEmpty) return const Point(0, 0, 0);
if (pts.length == 1) return pts[0];
double cx = 0, cy = 0;
for (final p in pts) {
cx += p.x;
cy += p.y;
}
cx /= pts.length;
cy /= pts.length;
int bestIdx = 0;
double bestDist = double.infinity;
for (int i = 0; i < pts.length; i++) {
final dx = pts[i].x - cx;
final dy = pts[i].y - cy;
final d = dx * dx + dy * dy;
if (d < bestDist) {
bestDist = d;
bestIdx = i;
}
}
return pts[bestIdx];
}