using System.Collections.Generic; namespace Assets.Common { public static class PointUtils { public static Point Mean(IEnumerable points) { var result = new Point(0, 0); var i = 0; foreach (var point in points) { result.x = (result.x * i + point.x) / (i + 1); result.y = (result.y * i + point.y) / (i + 1); i++; } return result; } public static bool IsClockwise(Point center, Point a, Point b) { var xa = a.x - center.x; var xb = b.x - center.x; var ya = a.y - center.y; var yb = b.y - center.y; return xa * yb - xb * ya < 0; } } }