base foudations
This commit is contained in:
18
buildings/geometry/Vertice.py
Normal file
18
buildings/geometry/Vertice.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from Enums import DIRECTION
|
||||
from buildings.geometry.Point import Point
|
||||
from buildings.geometry.Rectangle import Rectangle
|
||||
|
||||
class Vertice(Rectangle):
|
||||
def __init__(self, point1 : Point, point2 : Point, facing : str):
|
||||
Rectangle.__init__(self, point1, point2)
|
||||
self.facing = facing
|
||||
|
||||
def get_neighbors(self):
|
||||
match self.facing:
|
||||
case DIRECTION.NORTH | DIRECTION.SOUTH:
|
||||
return [Point(x = self.point1.x - 1, z = self.point1.z),
|
||||
Point(x = self.point2.x + 1, z = self.point2.z)]
|
||||
case DIRECTION.EAST | DIRECTION.WEST:
|
||||
return [Point(x = self.point1.x, z = self.point1.z - 1),
|
||||
Point(x = self.point2.x, z = self.point2.z + 1)]
|
||||
|
||||
Reference in New Issue
Block a user