Advertisement
Guest User

Untitled

a guest
Apr 16th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def calculaarlalineacentro(x1, x2, gx, gy, image):
  2.     tangente1 = [x1, x2[1]-(gx*x1[0])]
  3.     t2 = [gy, x2[1]-(gy*x2[0])]
  4.     x = float(t2[1]-tan1[1]) / (tan1[0]-t2[0])
  5.     y = tan1[0]*x+ tan1[1]
  6.     inter = (x, y)
  7.     medio = ( (x1[0]+x2[0])/2, (x1[1]+x2[1])/2 )
  8.     if (inter[0]-medio[0]) != 0:m = (inter[1]-medio[1] ) / (inter[0]-medio[0])
  9.     else:m = 1000  
  10.     b = medio[1] - (m*medio[0])
  11.     lineadelcentro = [m, b]
  12.     if (inter[0]-medio[0]) < 0.0:dire = 1
  13.     else:direcc = -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement