コード例 #1
0
 def toBut(self, but):
   if but.x == 'abs':
     return but.y
   a = but.x - self.origin.x
   b = but.y - self.origin.y
   if a == 0 and b == 0:
     return rnd.nextDouble() * 360;
   if b < 0:
     return 180*Math.asin(a / Math.sqrt(Math.pow(a,2)+Math.pow(b,2)))/Math.PI+270
   else:
     return 180*Math.acos(a / Math.sqrt(Math.pow(a,2)+Math.pow(b,2)))/Math.PI
コード例 #2
0
 def toBut(self, but):
     if but.x == 'abs':
         return but.y
     a = but.x - self.origin.x
     b = but.y - self.origin.y
     if a == 0 and b == 0:
         return rnd.nextDouble() * 360
     if b < 0:
         return 180 * Math.asin(
             a / Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2))) / Math.PI + 270
     else:
         return 180 * Math.acos(
             a / Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2))) / Math.PI