Esempio n. 1
0
        public static float SumOfDistancesFromCenterOfGravity(IList <Position> points)
        {
            Position centerOfGravity = CenterOfGravityCalculator.CenterOfGravity(points);

            float sumOfDistances = 0.0f;

            foreach (var p in points)
            {
                sumOfDistances += (float)Math.Sqrt(Position.SquaredDistance(centerOfGravity, p));
            }

            return(sumOfDistances);
        }
Esempio n. 2
0
        public static float SumOfDistancesFromCentreOfGravity(IList <Position> positions)
        {
            var centerOfGravity =
                CenterOfGravityCalculator.CenterOfGravity(positions);

            float sumOfDistances = 0.0f;

            foreach (var p in positions)
            {
                sumOfDistances += Position.Distance(centerOfGravity, p);
            }

            return(sumOfDistances);
        }