Virtual_Universe

Три точки и круг

Jan 16th, 2016
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import sqrt
  2. (x1,y1) = map(int,input().split())
  3. (x2,y2) = map(int,input().split())
  4. (x3,y3) = map(int,input().split())
  5. def dist(a1,b1,a2,b2):
  6.     return sqrt((a1-a2)**2+(b1-b2)**2)
  7. def point(a1,b1,a2,b2):
  8.     if a1!=a2:
  9.         v = a1-a2
  10.         x = abs(v)/2
  11.         c = b1-b2
  12.         k = c/v
  13.         b = b1-a1*k
  14.         y = k*x+b
  15.         return x,y
  16.     else:
  17.         y = abs(b1-b2)
  18.         y - y/2
  19.         return a1,y
  20. def moreO():
  21.     if dist(x1,y1,x2,y2)>dist(x2,y2,x3,y3):
  22.         if dist(x1,y1,x2,y2)>dist(x3,y3,x1,y1):
  23.             return x1,y1,x2,y2
  24.         else:
  25.             return x3,y3,x1,y1
  26.     elif dist(x2,y2,x3,y3)>dist(x3,y3,x1,y1):
  27.             return x2,y2,x3,y3
  28.     else:
  29.          return x3,y3,x1,y1
  30. def moreP(a,b):
  31.     if dist(a,b,x1,y1)>dist(a,b,x2,y2):
  32.         if dist(a,b,x1,y1)>dist(a,b,x3,y3):
  33.             return dist(a,b,x1,y1)
  34.         else:
  35.             return dist(a,b,x3,y3)
  36.     elif dist(a,b,x2,y2)>dist(a,b,x3,y3):
  37.             return dist(a,b,x2,y2)
  38.     else:
  39.          return dist(a,b,x3,y3)
  40. print(moreP(point(moreO()[0],moreO()[1],moreO()[2],moreO()[3])[0],point(moreO()[0],moreO()[1],moreO()[2],moreO()[3])[1]))
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×