示例#1
0
文件: Site.cs 项目: sztosz/Blackout
 private static int Compare(Site s1, Site s2)
 {
     var returnValue = CompareByYThenX(s1, s2);
     int tmpIndex;
     if (returnValue == -1) {
         if (s1._siteIndex > s2._siteIndex) {
             tmpIndex = s1._siteIndex;
             s1._siteIndex = s2._siteIndex;
             s2._siteIndex = tmpIndex;
         }
     }
     if (returnValue == 1) {
         if (s2._siteIndex > s1._siteIndex) {
             tmpIndex = s2._siteIndex;
             s2._siteIndex = s1._siteIndex;
             s1._siteIndex = tmpIndex;
         }
     }
     return returnValue;
 }
示例#2
0
文件: Vector.cs 项目: sztosz/Blackout
 public static double Dist(Vector vector, Site site)
 {
     if (vector.Dimension != 2) {
         return -1;
     }
     return Math.Pow(vector.X - site.X, 2) + Math.Pow(vector.Y - site.Y, 2); ;
 }
示例#3
0
文件: Site.cs 项目: sztosz/Blackout
 private static int CompareByYThenX(Site s1, Site s2)
 {
     if (s1.y < s2.y) {
         return -1;
     }
     if (s1.y > s2.y) {
         return 1;
     }
     if (s1.x < s2.x) {
         return -1;
     }
     if (s1.x > s2.x) {
         return -1;
     }
     return 0;
 }