コード例 #1
0
 public static FactorFormula LinearToZeroInRadius(SpotEntity spot)
 {
     return(p =>
     {
         double d = spot.GetDistTo(p);
         return (d > spot.ServingRadius) ? 0 : spot.Coefficient *(1 - d / spot.ServingRadius);
     });
 }
コード例 #2
0
 public static FactorFormula ExponentialAttenuation(SpotEntity spot)
 {
     return(p =>
     {
         double d = spot.GetDistTo(p);
         return Math.Pow(spot.Coefficient, 1 - d / spot.ServingRadius);
     });
 }
コード例 #3
0
 public static FactorFormula ZeroOne(SpotEntity spot)
 {
     return(p =>
     {
         double d = spot.GetDistTo(p);
         return (d > spot.ServingRadius) ? 0 : spot.Coefficient;
     });
 }
コード例 #4
0
 public static FactorFormula InverseSquare(SpotEntity spot, double maxValue = double.MaxValue)
 {
     return(p =>
     {
         double d = spot.GetDistTo(p);
         double v = spot.Coefficient / d / d;
         if (v > 0)
         {
             return v > maxValue ? maxValue : v;
         }
         else
         {
             return v < -maxValue ? -maxValue : v;
         }
     });
 }