def __init__(self): self.__shapes = [] self.limit = Square("limit", np.array([[]], dtype=np.int32)) self.robot = Robot(Shape("robot", np.array([[]], dtype=np.int32)), Shape("orientation", np.array([[]], dtype=np.int32))) self.target = None self.treasures = [] self.orientationForTreasure = 0
def setMapLimit(self, contour): cornerList = [] minX = 0 maxX = 960 minY = 105 maxY = 587 #table 1 : (0,110), (960,590) #table 2 : (0,109), (960,597) #table 3 : (0,105), (960,587) #table 5 : (0,125), (960,605) #table 6 : (0,92), (960,580) newFoundLimit = Square("limit", np.array([[[minX,minY + 5]],[[minX,maxY - 5]],[[maxX, maxY - 5]],[[maxX,minY + 5]]], dtype=np.int32)) if newFoundLimit.getArea() < self.limit.getArea() or len(self.limit.getContour()) == 0: self.limit = newFoundLimit