def __noCollision_ObstacleIsNotTheLastOne(self, compteur, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = (self.obstaclesList[compteur + 1].positionX - self.SAFE_MARGIN, 0 + (self.SAFE_MARGIN - 20)) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) self.obstaclesList[compteur + 1].setStartingNode(endNode) return endNode
def generateSafeZone(self, safeZoneCornerBotLeft, safeZoneCornerTopLeft, safeZoneCornerTopRight): safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) tempNode = safeZone.getCenterNodeOfSafeZone() self.safeZonesList.append(safeZone) tempNode.isASafeNode = True return tempNode
def __noCollision_ObstacleIsNotTheLastOne(self, compteur, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = ( self.obstaclesList[compteur + 1].positionX - self.SAFE_MARGIN, 0 + (self.SAFE_MARGIN - 20), ) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) self.obstaclesList[compteur + 1].setStartingNode(endNode) return endNode
def __oneCollision_CollisionIsTop_noCollisionBeforeTheSideOfMap(self, collisionBottomRightCornerTemp, collisionUpperRightCorner, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = (collisionBottomRightCornerTemp.positionX - self.SAFE_MARGIN, collisionUpperRightCorner.positionY + self.SAFE_MARGIN) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) endNode.isASafeNode = True collisionBottomRightCornerTemp.setStartingNode(endNode) return endNode
def __ObstacleBetweenTheTwoCollision(self, collisionUpperRightCorner, collisionUpperRightCornerTemp, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = (collisionUpperRightCornerTemp.positionX - self.SAFE_MARGIN, collisionUpperRightCorner.positionY + self.SAFE_MARGIN) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) collisionUpperRightCornerTemp.setStartingNode(endNode) endNode.isASafeNode = True return endNode
def __ObstacleBetweenTheTwoCollision( self, collisionUpperRightCorner, collisionUpperRightCornerTemp, safeZoneCornerBotLeft, safeZoneCornerTopLeft ): safeZoneCornerTopRight = ( collisionUpperRightCornerTemp.positionX - self.SAFE_MARGIN, collisionUpperRightCorner.positionY + self.SAFE_MARGIN, ) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) collisionUpperRightCornerTemp.setStartingNode(endNode) endNode.isASafeNode = True return endNode
def __oneCollision_CollisionIsTop_noCollisionBeforeTheSideOfMap( self, collisionBottomRightCornerTemp, collisionUpperRightCorner, safeZoneCornerBotLeft, safeZoneCornerTopLeft ): safeZoneCornerTopRight = ( collisionBottomRightCornerTemp.positionX - self.SAFE_MARGIN, collisionUpperRightCorner.positionY + self.SAFE_MARGIN, ) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) endNode.isASafeNode = True collisionBottomRightCornerTemp.setStartingNode(endNode) return endNode
class SafeZoneTest(TestCase): def setUp(self): self.safeZone = SafeZone((0, 0), (200, 0), (0, 100)) def test_getGoodCenterOfZone(self): centerNode = self.safeZone.getCenterNodeOfSafeZone() theCenter = (100, 50) self.assertEqual(centerNode.positionX, theCenter[0]) self.assertEqual(centerNode.positionY, theCenter[1])
class SafeZoneTest(TestCase): def setUp(self): self.safeZone = SafeZone((0,0),(200,0),(0,100)) def test_getGoodCenterOfZone(self): centerNode = self.safeZone.getCenterNodeOfSafeZone() theCenter = (100,50) self.assertEqual(centerNode.positionX, theCenter[0]) self.assertEqual(centerNode.positionY, theCenter[1])
def setUp(self): self.safeZone = SafeZone((0, 0), (200, 0), (0, 100))
def __noCollision_obstacleIsTheLastOne(self, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = (self.MAP_SIZE_X, 0 + (self.SAFE_MARGIN - 20)) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) return endNode
def __noCollision_obstacleIsTheLastOne(self, safeZoneCornerBotLeft, safeZoneCornerTopLeft): safeZoneCornerTopRight = (self.MAP_SIZE_X, 0 + (self.SAFE_MARGIN - 20)) safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) endNode = safeZone.getCenterNodeOfSafeZone() self.graph.safeZonesList.append(safeZone) return endNode
def generateSafeZone(self, safeZoneCornerBotLeft, safeZoneCornerTopLeft, safeZoneCornerTopRight): safeZone = SafeZone(safeZoneCornerTopLeft, safeZoneCornerTopRight, safeZoneCornerBotLeft) tempNode = safeZone.getCenterNodeOfSafeZone() self.safeZonesList.append(safeZone) tempNode.isASafeNode = True return tempNode
def setUp(self): self.safeZone = SafeZone((0,0),(200,0),(0,100))