This repository has been archived on 2025-05-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
SmartDots/obstacle.py
2019-07-16 16:06:30 +02:00

10 lines
290 B
Python

from vector import Point
class Obstacle:
def __init__(self, p1: Point, p2: Point):
self.p1: Point = p1
self.p2: Point = p2
def check_collision(self, p: Point) -> bool:
return self.p1.x - 2 <= p.x <= self.p2.x + 2 and self.p1.y - 2 <= p.y <= self.p2.y + 2