Advertisement
Guest User

Untitled

a guest
Jan 6th, 2014
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. x1 = 200
  2. y1 = 400
  3. x2 = 700
  4. y2 = 200
  5. dist = 20
  6.  
  7. x3 = (x1 + x2) / 2
  8. y3 = (y1 + y2) / 2
  9.  
  10. a = x2-x1
  11. b = y1 - y2
  12.  
  13. norm = sqrt(a*a + b*b)
  14. a = a / norm
  15. b = b / norm
  16.  
  17. x4 = x3 + a * dist
  18. y4 = y3 + b * dist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement