Пример #1
0
        public static double AngleBetween(this ICoordinated point, ICoordinated a, ICoordinated b)
        {
            var distA    = point.Distance(a);
            var distB    = point.Distance(b);
            var DistC    = a.Distance(b);
            var angleCos = (Math.Pow(distA, 2) + Math.Pow(distB, 2) - Math.Pow(DistC, 2)) / (2 * distA * distB);
            var angle    = Math.Acos(angleCos);

            return(angle);
        }
Пример #2
0
        public double ForceNbs(ICoordinated from, ICoordinated to)
        {
            var dist = from.Distance(to);

            return(Math.Min(25, -8 + dist * 0.5));
            //return -Math.Min(100, Math.Exp(-dist * 0.01)) + Math.Log(dist);
        }
Пример #3
0
        public double ForceForeign(ICoordinated from, ICoordinated to)
        {
            var dist = from.Distance(to);

            var optimalMinDistance = 100;

            return(-Math.Max(0, (optimalMinDistance - dist) / optimalMinDistance));
        }
Пример #4
0
        public double ForceRepell(ICoordinated from, ICoordinated to)
        {
            var dist = from.Distance(to);

            var distOne = 20;

            return(Math.Min(0, -distOne + dist * 0.25));
            //return -distOne / (3 * dist);
            //return -Math.Min(10, Math.Exp(-dist * 0.01));
        }
Пример #5
0
        public double ForceRepell(ICoordinated from, ICoordinated to)
        {
            var dist = from.Distance(to);

            var distOne = 20;

            //  return 20 * Math.Min(0, -distOne + dist * 0.25);
            //   return -distOne / (3 * dist);
            //  return 12 * -Math.Min(100, Math.Exp(-dist * 0.0));
            return(-1000 * (1 / (Math.Pow(dist, 1.1))));
        }
Пример #6
0
        public double ForceNbs(ICoordinated from, ICoordinated to)
        {
            var dist = from.Distance(to);

            //if (dist < 50)
            //    return 25;
            //if( dist < 200)
            //{
            //    return  (dist-50) * 0.125;
            //}
            //else

            //return (dist-200) * 0.5;
            return(Math.Pow(Math.Log(dist), 2));
        }