Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculaarlalineacentro(x1, x2, gx, gy, image):
- tangente1 = [x1, x2[1]-(gx*x1[0])]
- t2 = [gy, x2[1]-(gy*x2[0])]
- x = float(t2[1]-tan1[1]) / (tan1[0]-t2[0])
- y = tan1[0]*x+ tan1[1]
- inter = (x, y)
- medio = ( (x1[0]+x2[0])/2, (x1[1]+x2[1])/2 )
- if (inter[0]-medio[0]) != 0:m = (inter[1]-medio[1] ) / (inter[0]-medio[0])
- else:m = 1000
- b = medio[1] - (m*medio[0])
- lineadelcentro = [m, b]
- if (inter[0]-medio[0]) < 0.0:dire = 1
- else:direcc = -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement