Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def intersects(self, line2):
- # oversimplification?
- if self.dir == line2.dir:
- return []
- if self.dir == "X":
- assert line2.p1.x == line2.p2.x
- if self.p1.x < line2.p1.x and self.p2.x > line2.p1.x:
- if line2.p1.y < self.p1.y and line2.p2.y > self.p1.y:
- return [Pt(line2.p1.x, self.p1.y)]
- else:
- return []
- else:
- return []
- elif self.dir == "Y":
- assert line2.dir == "X"
- return line2.intersects(self)
- else:
- raise RuntimeError("Hm, F.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement