Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. class AugIntPair(p:(Int,Int)) {
  2. @inline def x = p._1
  3. @inline def y = p._2
  4. @inline def |+|(pr:(Int,Int)) = (p._1 + pr._1, p._2 + pr._2)
  5. @inline def |+(i:Int) = (p._1 + i, p._2)
  6. @inline def +|(j:Int) = (p._1, p._2 + j)
  7.  
  8. @inline def |-|(pr:(Int,Int)) = (p._1 - pr._1, p._2 - pr._2)
  9. @inline def |-(i:Int) = (p._1 - i, p._2)
  10. @inline def -|(j:Int) = (p._1, p._2 - j)
  11.  
  12. @inline def abs = (math.abs(p._1), math.abs(p._2))
  13. @inline def signum = (math.signum(p._1), math.signum(p._2))
  14.  
  15. @inline def mag = (x*x + y*y).sqrt
  16. @inline def mag2 = x*x + y*y
  17.  
  18. @inline def -->(d:Direction) = (p._1 + d.dx, p._2 + d.dy)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement