SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def intersects(self, line2):
  2.         # oversimplification?
  3.         if self.dir == line2.dir:
  4.             return []
  5.         if self.dir == "X":
  6.             assert line2.p1.x == line2.p2.x
  7.             if self.p1.x < line2.p1.x and self.p2.x > line2.p1.x:
  8.                 if line2.p1.y < self.p1.y and line2.p2.y > self.p1.y:
  9.                     return [Pt(line2.p1.x, self.p1.y)]
  10.                 else:
  11.                     return []
  12.             else:
  13.                 return []
  14.         elif self.dir == "Y":
  15.             assert line2.dir == "X"
  16.             return line2.intersects(self)
  17.         else:
  18.             raise RuntimeError("Hm, F.")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top